Android手机主题开发
我想在这里为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论