【发布时间】:2014-05-20 10:01:58
【问题描述】:
我想制作一个类似于以下的自定义操作栏:
我看到了How to align items in action bar to the left? 和Positioning menu items to the left of the ActionBar in Honeycomb 的问题,但他们似乎没有回答我的问题。
当我处于纵向模式时,我有一个分屏。菜单图标位于底部,顶部看起来像上图的右侧。但是,在横向模式下,图标会挤在应用图标的右侧。我希望它们显示在左侧。
这是我当前用于操作栏的 xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/appIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@android:drawable/ic_app" />
<TextView
android:id="@+id/tvAppTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/appIcon"
android:text="@string/app_name" />
</RelativeLayout>
【问题讨论】: