我按照教程在我的应用程序中获取动作栏.但即使我在我的Manifest文件中放置了
android:uiOptions =“splitactionBarWhenNarrow”,它仍然保持在顶部.任何人对如何处理此代码有任何想法?
XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#f0f0f0"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/myFragments"
android:layout_width="match_parent"
android:layout_height="0dp">
</LinearLayout>
</LinearLayout>
清单文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.alotoftesting"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:uiOptions="splitactionBarWhenNarrow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
解决方法
谷歌默认操作栏在任何情况下都不会显示在底部.正如其他人提到的那样,当设备很窄时,splitactionBarWhenNarrow只会在屏幕底部放置一个ActionBar的子集(如制表符等).不幸的是,如果你想在屏幕底部实现类似ActionBar的接口,你必须自己实现它(
a quick search finds this example),因为我还没有看到任何库为你做这件事.
总而言之,我建议反对它,因为它违反了设计文档中的Seamlessness design principle,打破了用户对ActionBar类型控件所在位置的期望 – 一个Android用户理想地习惯于以某种方式做事,你需要一个非常令人信服的理由打破这种期望.