如何更改主题的Andr​​oid应用程序?应用程序、如何更改、主题、Andr

由网友(赤烈马)分享简介:我开发一个Android应用程序,我想改变应用程序的颜色和主题。我怎样才能做到这一点?I'm developing an Android application and I want to change the color and theme of the application. How can I do this...

我开发一个Android应用程序,我想改变应用程序的颜色和主题。我怎样才能做到这一点?

I'm developing an Android application and I want to change the color and theme of the application. How can I do this?

推荐答案

开发指南介绍如何应用主题和风格。

本:

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textColor="#00FF00"
    android:typeface="monospace"
    android:text="@string/hello" />

成为本:

<TextView
    style="@style/CodeFont"
    android:text="@string/hello" />

通过定义XML主题文件:

By defining an xml theme file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CodeFont" parent="@android:style/TextAppearance.Medium">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#00FF00</item>
        <item name="android:typeface">monospace</item>
    </style>
</resources>

您也可以将样式应用于应用程序的所有活动:

You can also apply styles to all activities of an application:

<application android:theme="@style/CustomTheme">

或者只是一个活动:

Or just one activity:

<activity android:theme="@android:style/Theme.Dialog">
阅读全文

相关推荐

最新文章