Android withText 选项不适用于 Huawei MediaPad (T1-A21L) 上的操作栏按钮
Android withText option does not work for action bar buttons on Huawei MediaPad (T1-A21L)
此平板电脑操作栏上的按钮,如果显示有文字,则会出现文字变形,如下面的屏幕截图所示:
我尝试了很多可能的设置组合(ifRoom、always、withText,...)。即使试图操纵按钮的实际视图也无济于事(或者我没有坚持足够)。设置 TextView 和父 LinearLayout 的宽度没有效果,除非它们是固定数字。
有什么想法吗?
编辑:
我忘记提到尝试将图标与文本一起使用 仅 显示图标。这是使用本机操作栏。下面是上面操作按钮的xml:
<item
android:id="@+id/itemConfig"
android:showAsAction="ifRoom|withText"
android:title="Network Config"
android:visible="true"/>
按以下方式设置菜单项:
<item
android:id="@+id/itemConfig"
android:icon="@drawable/ic_action_networkconfig"
android:showAsAction="ifRoom|withText"
android:title="@string/network_config"
android:visible="true"/>
导致这个
所以本质上,平板电脑不喜欢其操作栏中的文字。有什么线索吗?
来源:
http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems
如果您的菜单项同时提供标题和图标(具有标题和图标属性),则默认情况下操作项仅显示图标。
如果要显示文本标题,请在 showAsAction 属性中添加 "withText"。
注意: "withText" 值是提示操作栏应该出现文本标题。 操作栏将尽可能显示标题,但如果图标可用且操作栏受限于 space。[=11=,则可能不会显示标题]
看起来你的菜单代码是正确的。作为参考,检查我的菜单项 xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/itemConfig"
android:icon="@drawable/icon"
app:showAsAction="withText|always"
android:title="@string/network_config"/>
</menu>
只有 space,设备才会显示带有图标的文本。您可以使用横向模式进行检查。这是例子
长话短说,做不到:)
此平板电脑操作栏上的按钮,如果显示有文字,则会出现文字变形,如下面的屏幕截图所示:
我尝试了很多可能的设置组合(ifRoom、always、withText,...)。即使试图操纵按钮的实际视图也无济于事(或者我没有坚持足够)。设置 TextView 和父 LinearLayout 的宽度没有效果,除非它们是固定数字。
有什么想法吗?
编辑:
我忘记提到尝试将图标与文本一起使用 仅 显示图标。这是使用本机操作栏。下面是上面操作按钮的xml:
<item
android:id="@+id/itemConfig"
android:showAsAction="ifRoom|withText"
android:title="Network Config"
android:visible="true"/>
按以下方式设置菜单项:
<item
android:id="@+id/itemConfig"
android:icon="@drawable/ic_action_networkconfig"
android:showAsAction="ifRoom|withText"
android:title="@string/network_config"
android:visible="true"/>
导致这个
所以本质上,平板电脑不喜欢其操作栏中的文字。有什么线索吗?
来源: http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems
如果您的菜单项同时提供标题和图标(具有标题和图标属性),则默认情况下操作项仅显示图标。
如果要显示文本标题,请在 showAsAction 属性中添加 "withText"。
注意: "withText" 值是提示操作栏应该出现文本标题。 操作栏将尽可能显示标题,但如果图标可用且操作栏受限于 space。[=11=,则可能不会显示标题]
看起来你的菜单代码是正确的。作为参考,检查我的菜单项 xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/itemConfig"
android:icon="@drawable/icon"
app:showAsAction="withText|always"
android:title="@string/network_config"/>
</menu>
只有 space,设备才会显示带有图标的文本。您可以使用横向模式进行检查。这是例子
长话短说,做不到:)