Pre*_*ete 2 android android-layout android-theme
我是Android新手,似乎挂了一点......
我正在尝试构建我的第一个Android应用程序.该应用程序主要是Eclipse为您创建的模板...
我想使用Holo主题的基础和默认的黑色背景.我可以通过在Manifest中硬编码"@android:style/Theme.Holo"来实现它(在模拟器上).但我不能把它从styles.xml中拉出来.
即使我在Manifest中进行硬编码,Eclipse仍然在Activity编辑器中显示白色背景,这使得在白色背景上设计白色文本变得困难......
我确定这是我想念的小事.请看下面......
先谢谢彼得
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.domain.test2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="@drawable/icon48"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ca.domain.test2.Something"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
和
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
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">
<!--
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>
Run Code Online (Sandbox Code Playgroud)
这是因为你将它放在res/values/styles.xml文件中,这意味着它被应用于每个API版本的应用程序,但最多10个版本不支持Holo主题.所以,这就是你的文件应该是这样的:
RES /值/ 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:style/Theme.Black">
<!--
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>
Run Code Online (Sandbox Code Playgroud)
RES /值-V11/styles.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">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
RES /值-V14/styles.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">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1530 次 |
| 最近记录: |