【问题标题】:ActionBarSherlock in the bottom of screen屏幕底部的 ActionBarSherlock
【发布时间】:2012-12-10 21:52:33
【问题描述】:

我已经搜索了很多如何将 ActionBarSherlock 定位到屏幕底部,感谢上帝,它使用此代码可以工作

<activity
   android:name=".MyActivity"
   android:uiOptions="splitActionBarWhenNarrow" >
</activity>

但有一个小问题,标题仍然存在,我也想将其删除,所以任何人都可以帮我删除 ActionBarSherlock 的标题

提前致谢

【问题讨论】:

  • 对不起 Nachi,但这对 ICS 设备没有帮助,但我使用 ActionBarSherlock 能够为早期设备使用操作栏,我想删除此库中的标题

标签: android menu android-actionbar actionbarsherlock


【解决方案1】:

splitActionBarWhenNarrow 表示它将被拆分,不会移动到任何地方,并且只有在变窄时才会移动。因此,如果您在纵向或宽屏幕中,菜单选项将始终显示在顶部。您不能强制在底部绘制 ActionBar。相反,您可能希望完全禁用 ActionBar,并使用带有 actionButtonStyle 的 ImageButtons 将您自己的自定义视图放在底部

<style name="NoActionBar" parent="@android:style/Theme.Holo.Light">
    <item name="android:windowActionBar">false</item>
    <item name="android:windowNoTitle">true</item>
</style> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/title"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/buttons_holder"
        android:ellipsize="end"
        style="@style/TextAppearance.Sherlock.Widget.ActionBar.Title"/>

    <LinearLayout
        android:id="@+id/buttons_holder"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true" >

        <ImageButton
            android:id="@+id/acion_add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/menu_label_add"
            style="?attr/actionButtonStyle" />

        <ImageButton
            android:id="@+id/action_prev"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/menu_label_prev"
            style="?attr/actionButtonStyle" />

        <ImageButton
            android:id="@+id/action_next"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/menu_label_next"
            style="?attr/actionButtonStyle" />

    </LinearLayout>

</RelativeLayout>

【讨论】:

  • 但我正在使用 ActionBarSherlock 来在早期的设备(如 2.3.3)中制作 Action Bar
  • 不能将ActionBar放到底部。您可以改用看起来相似的布局。
  • @DoctororDrive : 我在“demo app”-“Split action Item”中看到了屏幕底部的action bar
  • @kAnNaN 它不在底部。它位于顶部,菜单项位于底部。这就是为什么它被称为“分裂”。而且它不会在平板电脑或横向模式下保持分裂。
猜你喜欢
  • 1970-01-01
  • 2013-07-08
  • 2013-04-29
  • 1970-01-01
  • 2021-03-20
  • 2013-08-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多