Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓主题。全息不工作_Android_Themes - Fatal编程技术网

Android 安卓主题。全息不工作

Android 安卓主题。全息不工作,android,themes,Android,Themes,我正在尝试让我的应用程序使用主题“theme.Holo”,这是android的黑暗主题。我的应用程序最小SDK是9,我有谷歌提供的支持库 我让我的应用程序使用黑暗主题,我不知道我改变了什么,现在它只有光明。而ic蚂蚁似乎改变了它 这是我之前的按钮(我想要这个): 这就是我现在拥有的: 这是我的值/res/styles.xml <resources> <!-- Base application theme, dependent on API leve

我正在尝试让我的应用程序使用主题“theme.Holo”,这是android的黑暗主题。我的应用程序最小SDK是9,我有谷歌提供的支持库

我让我的应用程序使用黑暗主题,我不知道我改变了什么,现在它只有光明。而ic蚂蚁似乎改变了它

这是我之前的按钮(我想要这个):

这就是我现在拥有的:

这是我的值/res/styles.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>
<resources>

    <!--
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    -->
    <style name="AppBaseTheme" parent="@android:style/Theme.Holo">
        <!-- API 11 theme customizations can go here. -->
    </style>

</resources>
<resources>

    <!--
        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    -->
    <style name="AppBaseTheme" parent="@android:style/Theme.Holo">
        <!-- API 14 theme customizations can go here. -->
    </style>

</resources>

这是我的res/values-11/styles.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>
<resources>

    <!--
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    -->
    <style name="AppBaseTheme" parent="@android:style/Theme.Holo">
        <!-- API 11 theme customizations can go here. -->
    </style>

</resources>
<resources>

    <!--
        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    -->
    <style name="AppBaseTheme" parent="@android:style/Theme.Holo">
        <!-- API 14 theme customizations can go here. -->
    </style>

</resources>

和res/values-14/styles.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>
<resources>

    <!--
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    -->
    <style name="AppBaseTheme" parent="@android:style/Theme.Holo">
        <!-- API 11 theme customizations can go here. -->
    </style>

</resources>
<resources>

    <!--
        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    -->
    <style name="AppBaseTheme" parent="@android:style/Theme.Holo">
        <!-- API 14 theme customizations can go here. -->
    </style>

</resources>

显示与主题相关的部分

   <application 
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity


正如@FD_u所指出的,全息主题可在ICS及以上版本上使用。我假设您正在测试的模拟器/设备的SDK<11


如果您需要全息主题的向后兼容性,请使用Prototik提供的库

要使用
主题.Holo
您必须至少使用
API 11级
。请参阅Android开发者指南中的链接。

尝试将Android清单中的最低API版本更改为11,它应该可以工作。

Emulator和device是4.4.2。我只是将min SDK设置为11,然后设置为13,并且仍然相同。浅颜色的按钮,我以前用过深颜色的按钮。我不知道我在我的项目中改变了什么,把它转换成了Light。OP发布了用于特定api级别的样式(v11和v14的单独样式)。如果将目标apk设置为最新,这样就可以根据它编译api。我觉得没有必要修改min SDK版本,我修改了min SDK,没有效果。因此,关于单独的样式,您是正确的。我对旧设备的旧的灰色安卓按钮很满意。