[英]Getting a lot of errors when trying to change theme. I am using appcompat v7 action bar
這是我的清單代碼:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.calculator.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>
這是來自styles.xml的代碼
<resources>
<style name="Theme.Holo" parent="android:Theme.Holo">
</style>
<style name="AppTheme" parent="Theme.Holo">
</style>
</resources>
上面的代碼使我的應用程序崩潰。
當我將manifest.xml中的行更改為
android:theme="@style/Theme.AppCompat
它完美地工作。我的問題是如何從AppCompat派生主題而不會出現錯誤,以及如何使用它們動態更改主題。
嘗試在此處添加主題:
<resources>
<style name="Theme.AppCompat" parent="android:Theme.AppCompat">
</style>
<style name="Theme.Holo" parent="android:Theme.Holo">
</style>
<style name="AppTheme" parent="Theme.Holo">
</style>
</resources>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.