我现在遇到了在菜单中使用“android:actionLayout”的问题。ActionBar上的自定义菜单项
我已经使用这个和一些我以前项目的工作,但现在我不知道是怎么回事。
当我输入
android:title="@string/menu_notifications"
android:actionLayout="@layout/menu_notification"
动作条中的每一个图标在我的应用程序更改为文本。
我尝试了很多事情没有工作过。我不知道发生了什么。
请一些建议/想法?
编辑: menu_notification.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="TEST"
android:textSize="20dp"
android:textColor="#F00"
/>
</LinearLayout>
编辑2:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
确定 “menu_notification” 是一个XML –
@MSS是它的XML – user1730007
什么操作系统的版本,你测试过吗? –