2013-04-10 127 views
1

我有一個應用程序可能從2.2到4.x設備運行。Android設置默認設備主題

當我在4.x上運行這個應用程序時,它看起來很酷,全息風格。但是當我在較舊的設備上運行它時,它似乎非常「輕盈」。

有一個截圖這樣你可以比較: enter image description here

這是我的清單:

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

而我的風格:

<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.Holo.Light.NoActionBar.Fullscreen"> 

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

很明顯,全息沒有按2.3中不存在,但它應該是r使用默認的設備主題,對吧?

所以輸入是正確的,但TextView看起來太灰色。

任何想法?

+0

它不在屏幕截圖中看起來很灰色...順便說一句,你可能會覺得這很有趣:https://github.com/Prototik/HoloEverywhere – kabuko 2013-04-10 21:33:35

+0

不是提示,標題頂部從輸入,左邊是黑色,右邊是灰色..「 – Reinherd 2013-04-10 21:49:13

+0

」很明顯2.3版本中不存在holo,但是它應該呈現其默認設備電子主題吧?「 - 理想情況下,您使用版本化的樣式資源(例如'res/values /','res/values-v11 /'),因此您可以控制*特別是*預Holo設備上使用的基本主題。 – CommonsWare 2013-04-10 21:58:26

回答

0

正如有人建議,我終於創建了一個新的文件夾: res/values-v11/ 在此文件夾中,我已經把一個名爲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.Holo.Light.NoActionBar.Fullscreen"> 

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

,文件夾res/values/這將是呼籲與API低於11機器人,包含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="MyTheme" parent="@android:style/Theme.Light"> 

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

這最終是這樣的:

  • 設備與API大於11 - >全息主題
  • 其餘:Theme.Light( 「正常主題」)