4

Androidチュートリアル(こちら)に従って、 Eclipseウィザードで作成した新しいAndroidアプリケーションのActionBarの色を変更しようとしていますが、いくつかの問題があります。

minSdkVersion を 10 に設定しました (Android 2.1 程度である必要があります)。

このコードをthemes.xmlに貼り付けると(チュートリアルで述べたように):

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/AppTheme">
        <item name="android:actionBarStyle">@style/MyActionBar</item>

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@style/AppTheme">
        <item name="android:background">#FFFFFF</item>

        <!-- Support library compatibility -->
        <item name="background">#FFFFFF</item>
    </style>
</resources>

Eclipseは私にこれらのエラーを与えます:

  • 5 行目: android:actionBarStyle には API レベル 11 が必要です (現在の最小値は 10 です)
  • 行 8: エラー: エラー: 指定された名前に一致するリソースが見つかりません: attr 'actionBarStyle'。
  • 16 行目: エラー: エラー: 指定された名前に一致するリソースが見つかりません: attr 'background'。

私は小さなもの (基本テーマと色) を変更しましたが、きれいなコードはチュートリアルにあります。

私のStyles.xmlはここにあります:

    <!--
        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.Light">
        <!--
            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>

どうしたの?

4

1 に答える 1