Android 将菜单项定位到蜂巢中操作栏的左侧
我想把一些菜单项放在Honycomb的ActionBar的左边,但没有找到说明如何操作的文档。这看起来应该是可能的,因为联系人应用程序在导航栏的最左边有搜索功能。你知道如何将菜单项设置到左边吗 ActionBar支持应用程序图标和常规ActionBar图标之间的自定义布局。例如:Android 将菜单项定位到蜂巢中操作栏的左侧,android,android-3.0-honeycomb,android-actionbar,Android,Android 3.0 Honeycomb,Android Actionbar,我想把一些菜单项放在Honycomb的ActionBar的左边,但没有找到说明如何操作的文档。这看起来应该是可能的,因为联系人应用程序在导航栏的最左边有搜索功能。你知道如何将菜单项设置到左边吗 ActionBar支持应用程序图标和常规ActionBar图标之间的自定义布局。例如: // Set the custom section of the ActionBar with Browse and Search. ActionBar actionBar = getActionBar(); mAct
// Set the custom section of the ActionBar with Browse and Search.
ActionBar actionBar = getActionBar();
mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
以下是我梦寐以求的东西:在活动中,我有以下几点:
//hiding default app icon
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowHomeEnabled(false);
//displaying custom ActionBar
View mActionBarView = getLayoutInflater().inflate(R.layout.my_action_bar, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM)
my_action_bar.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/turquoise">
<ImageButton
android:id="@+id/btn_slide"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@null"
android:scaleType="centerInside"
android:src="@drawable/btn_slide"
android:paddingRight="50dp"
android:onClick="toggleMenu"
android:paddingTop="4dp"/>
</RelativeLayout>
如何确定是否在ActionBar中单击了自定义视图?@CACuzcatlan,使用ActionBar.setDisplayOptions(ActionBar.DISPLAY\u SHOW\u custom\124; ActionBar.DISPLAY\u HOME);我使用了它,但布局仍然没有达到全宽,正如我提到的自定义视图父项的匹配父项…任何建议。