android手机主题开发

时间:2011-03-03 13:05:20

标签: android themes

我想在这里为Android手机开发一个主题代码,我在网站上找到了一些但是它不起作用。

我在/res/values/styles.xml中的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>

WidgetActivity:

public class WidgetActivity extends Activity {

    @Override protected void onCreate(Bundle bundle) {
      super.onCreate(bundle);

      Log.i(Global.TAG2, "sub-Activity WidgetActivity being creation: start");

      setTheme(R.style.Theme_Translucent);

      setContentView(Panel2Builder.createWidgetPanel(this));

      Log.i(Global.TAG2, "sub-Activity WidgetActivity being creation: end");

    }

}//end class WidgetActivity

这不符合我的预期。 任何人都有想法为Android的主题工作,并通过开发来实现。

0 个答案:

没有答案