Cha*_*ell 6 android android-theme xamarin
我正在尝试让我的应用程序使用Holo.Light主题.我为Holo创建了一个自定义主题并将其放入
资源的开发\值-V11\FsmTheme.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="FsmTheme" parent="@android:style/Theme.Holo.Light">
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
我还为旧版本创建了一个并将其放入
资源的开发\值\ FsmTheme.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="FsmTheme" parent="@android:style/Theme.Light.NoTitleBar">
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
然后我把它添加到我的 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="001" android:versionName="001" package="futurestate.app.droid">
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="14" />
<application android:label="FutureState App Demo" android:icon="@drawable/Icon" Theme="@style/FsmTheme" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Run Code Online (Sandbox Code Playgroud)
我不确定我还需要做些什么才能让主题在应用程序中占据一席之地.

Bre*_*age 15
您可以使用属性修改AndroidManifest.xml中的值,例如,这会将主题更改为holo light:
[Activity(
Label = "Foobar",
MainLauncher = true,
Theme = "@android:style/Theme.Holo.Light"
)]
public class MainActivity : Activity { ... }
Run Code Online (Sandbox Code Playgroud)
您也可以在应用程序级别执行此操作.
但是对于您的具体问题,您似乎正在命名您的样式文件FsmTheme.xml.那是不对的.您必须命名任何样式资源styles.xml,因此如果您将文件重命名为,Resources/values/styles.xml并且Resources/values-v11/styles.xml所有内容都应按预期工作.
细分就在这条线上.
<application android:label="FutureState App Demo" android:icon="@drawable/Icon" Theme="@style/FsmTheme" />
Run Code Online (Sandbox Code Playgroud)
一些教程显示
Theme="@style/ThemeName"
Run Code Online (Sandbox Code Playgroud)
但实际上你应该和元素的其余部分一样构造它
android:theme="@style/ThemeName"
Run Code Online (Sandbox Code Playgroud)
所以最终的结构将会阅读
<application android:label="FutureState App Demo" android:icon="@drawable/Icon" android:theme="@style/FsmTheme" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14201 次 |
| 最近记录: |