Android手机主题开发

发布于 2024-10-20 06:22:00 字数 1860 浏览 3 评论 0原文

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

我的 XML 代码位于 /res/values/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>

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 开发主题并通过开发来实现它。

I want to develop a theme for android mobile here the code which i found some where in site but it doesn't work.

My code for XML in /res/values/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>

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

this is not work as i expected.
can any one have idea to work on theme for android and make it by developing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文