使用预先编写的Android主题

时间:2013-12-15 16:02:04

标签: android android-theme

这正在推动我的坚果,这可能非常简单。

我知道如何在我的应用中更改主题。我想我只需要在AndroidManifest.xml中更改此行:

android:theme="@style/AppTheme"

您只需将AppTheme更改为values/styles.xml中的所有主题。

但是,我的styles.xml文件很无聊:

<style name="AppBaseTheme" parent="android:Theme.Light">

</style>
<style name="AppTheme" parent="AppBaseTheme">

</style>

即。我认为没有主题?

我在哪里下载主题?我需要什么......大概是styles.xml和一些资产(例如图片)。我主要是一名后端程序员,我只想要一些看起来比默认主题更有趣的东西。

感谢。

1 个答案:

答案 0 :(得分:1)

您无法下载我所知道的预先编写的Android主题。您可以使用来自互联网的一些片段并为自己制作styles.xml。例如,下面的代码是一个自定义主题:

<resources>
  <!-- Base application theme is the default theme. -->
  <style name="Theme" parent="android:Theme">
  </style>

  <!-- Variation on our application theme that has a translucent
 background. -->
  <style name="Theme.Translucent">
    <item name="android:windowBackground">@drawable/translucent_background</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:colorForeground">#fff</item>
  </style>

  <!-- Variation on our application theme that has a transparent
background; this example completely removes the background,
allowing the activity to decide how to composite. -->
  <style name="Theme.Transparent">
    <item name="android:windowBackground">@drawable/transparent_background</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:colorForeground">#fff</item>
  </style>
  <style name="TextAppearance.Theme.PlainText" parent="android:TextAppearance.Theme">
    <item name="android:textStyle">normal</item>
  </style>

</resources>

将此内容放在values文件夹中的styles.xml文件中。更改colorForeground等以创建您自己的主题。在drawable文件夹中添加您自己的图像并在此处引用它们,依此类推。

相关问题