2014-05-19 37 views
0

我想提出一个自定义的操作栏类似以下内容:自定义操作栏 - 如何交换菜单和应用图标/标题?

Custom action bar with home and menu swapped

我已经看到了问题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> 

回答

0

因为我无法找到使用操作栏与

<item name="android:windowActionBar">false</item> 
<item name="android:windowNoTitle">true</item> 

在样式的解决方案,我隐藏了操作栏.xml,然后创建一个自定义布局,以模仿纵向顶部和底部的操作栏,并仅在横向顶部显示。