2012-03-13 15 views

回答

182

你必须创建一个自定义主题,并将其保存在一些目录,终于确立这个主题作为默认一个用于应用

首先,在值增加的themes.xml这样的:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar"> 
     <!-- Any customizations for your app running on pre-3.0 devices here --> 
    </style> 
</resources> 

然后,创建与res目录名称“值-V11”(Android 3.0以上版本)的目录,并把一个的themes.xml这样

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light"> 
     <!-- Any customizations for your app running on 3.0+ devices here --> 
    </style> 
</resources> 

最后,创建一个目录与NA我“的价值观V14”(Android 4.0以上版本)在res目录,并创建一个的themes.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar"> 
     <!-- Any customizations for your app running on 4.0+ devices here --> 
    </style> 
</resources> 

随着DeviceDefault您的应用程序看起来永诺完美在任何公司(HTC三星...)中的任何设备添加为Android创建的自定义主题4

编辑:三星的界面(TouchWiz)不尊重这个功能和应用程序将是非常丑陋的三星的设备上。它最好把河洛主题:(

最后在你的manifest.xml

<application 
     ... 
     android:theme="@style/MyAppTheme"> 
+1

AARGH,我是个白痴,我应该意识到这得益于 – 2012-03-13 09:56:25

+2

记住投票并接受答案,请 – Aracem 2012-03-13 09:58:28

+1

@Aracem,你是什么意思“非常难看”意味着它将使用。!?老轻主题还是更糟糕? – l33t 2013-03-15 23:44:07

0

你也可以简单地将背景设置为白色,然后经历,使你的所有其他部件黑,像这样:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    **android:background="#ffffff" 
    android:orientation="vertical" > 

<TextView 
    android:id="@+id/tvText" 
    android:text="@string/text" 
    **android:textColor="#000000" 
    android:textSize="12dp" />