1

既存の Android プロジェクトをコピーして、半新規で開始しようとしています。私の古いプロジェクトでは、アプリケーションにカスタム テーマを適用することができました。私の新しいアプリケーションでは、すべての style.xml ファイルをコピーし、マニフェストの最小およびターゲット SDK バージョンを変更しましたが、最小/ターゲット SDK 用にビルドできません。ビルドはできますが、アプリケーションの上部には、アクション バーではなく、古いスタイルの通知バーがまだあります。IntelliJ/Android を強制的に新しいバージョン用にビルドする方法がわかりません。

私のマニフェスト

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

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <uses-sdk android:minSdkVersion="11"
              android:targetSdkVersion="16"/>
    <application
            android:label="@string/app_name"
            android:theme="@style/AppTheme"
            android:icon="@drawable/app_icon"
            android:name=".injected.C2Application"
            >
        <activity android:name=".HomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

私のスタイル

<?xml version="1.0" encoding="utf-8"?>
<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.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">
        <item name="android:actionBarStyle">@style/LoginActionBarStyle</item>
        <item name="android:textColorHint">#D1D1D1</item>
    </style>

    <style name="LoginActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:displayOptions">showHome</item>
        <item name="android:background">#333333</item>
    </style>

    <style name="LoginFormContainer">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:padding">16dp</item>
    </style>
</resources>

今の姿

今の姿

それは何を好むべきか

ここに画像の説明を入力

何が設定されているか、何が設定されていないかわかりません。

4

1 に答える 1

3

Holo から継承する V11+ 用の 2 つ目のスタイル ファイルが必要です。これを行う正しい方法を確認する最も簡単な方法は、新しい Hello World プロジェクトを作成し、そこでどのように行われたかを確認することです。

また、この手法を使用すると、アクションバーは V11+ デバイスでのみ表示されることに注意してください。すべてのデバイスで表示するには、 ActionBarSherlockを使用する必要がありますが、最小バージョンが 11 に設定されているため、2.3 の電話をサポートする予定がない可能性があります。

例:

スタイル.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.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>

値-v11 スタイル.xml

<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:Theme.Holo.Light">
    <!-- API 11 theme customizations can go here. -->
</style>

値-v14 スタイル.xml

<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:Theme.Holo.Light.DarkActionBar">
    <!-- API 14 theme customizations can go here. -->
</style>

マニフェスト.xml

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.test.test.com.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

于 2013-06-05T14:31:14.703 に答える