风格为Android:uiOptions =" splitActionBarWhenNarrow"?风格、Android、uiOptions、QUOT

2023-09-12 01:55:55 作者:不服输的倔强

使用SDK版本时,有谁知道样式资源用于拆分操作栏14 安卓?uiOptions =splitActionBarWhenNarrow

Does anyone know the style resource to use for the split action bar when using sdk version 14 android:uiOptions="splitActionBarWhenNarrow" ?

有关正常动作条我可以使用

<item name="android:actionBarStyle">@style/MyActionBar</item>

但这并不会自动溢出到底部的拆分栏。

But this does not automatically overflow to the split bar at the bottom.

我已经试过

    <item name="android:actionBarSplitStyle">@style/MyActionBar</item>
    <item name="android:actionBarTabBarStyle">@style/MyActionBar</item>

但他们都对Galaxy Nexus的无影响

But they both have no effect on the Galaxy Nexus

推荐答案

这答案基本上是 niko34 的,但在一个小更多的细节。目前,我有两个顶动作条和下部动作条(下动作条更正确地命名为分裂动作条)风格相同,但你会看到它的pretty的混账简单,不同的风格他们。我使用 ActionBarSherlock V4.2.0,并测试上都有了三星Galaxy S3运行这个完美运行果冻豆和宏达电Droid Incredible运行姜饼。

This answer is basically niko34's but in a little bit more detail. Currently I have both the top actionbar and the lower actionbar (the lower actionbar is more properly named as the split actionbar) styled the same, but you'll see it's pretty darn simple to style them differently. I am using ActionBarSherlock v4.2.0, and have tested and run this flawlessly on both a Samsung Galaxy S3 running Jelly Bean and an HTC Droid Incredible running Gingerbread.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="..."
    android:versionCode="1"
    android:versionName="0.1" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="16" />

    <application
        android:icon="@drawable/launcher"
        android:label="@string/app_name" >
        <activity
            android:label="@string/main_activity_title"
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Styled"
            android:uiOptions="splitActionBarWhenNarrow" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

RES /价值/的themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    </style>
    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
        <item name="background">@drawable/bg_actionbar</item>
        <item name="android:background">@drawable/bg_actionbar</item>
        <item name="backgroundSplit">@drawable/bg_actionbar</item>
        <item name="android:backgroundSplit">@drawable/bg_actionbar</item>
    </style>
</resources>

在这里你可以看到我是如何引用 @绘制/ bg_actionbar 几次。这是位于 RES /绘制目录中的XML文件。下面是该文件的来源。

Here you can see how I'm referencing @drawable/bg_actionbar a couple of times. That is an xml file that is located in the res/drawable directory. Below is the source of that file.

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:dither="true"
    android:src="@drawable/bg_tile"
    android:tileMode="repeat" />

下面,机器人:SRC =@可绘制/ bg_tile只是引用我的 bg_tile.png 文件,它位于 RES /绘制,华电国际 RES /绘制-LDPI RES /绘制-MDPI RES /绘制-xhdpi

Here, android:src="@drawable/bg_tile" is just referencing my bg_tile.png file, which is located in res/drawable-hdpi, res/drawable-ldpi, res/drawable-mdpi, and res/drawable-xhdpi.

所以,这一切是不是必要的可能更多的信息,但总比没有足够的更好! :)

So all of this was probably more information than necessary, but it's better than not having enough! :)