AppBaseTheme在Android应用程序中做了什么

AppBaseTheme在Android应用程序中做了什么,第1张

概述我无法理解AppBaseTheme在 Android中会发生什么. 在styles.xml中,我有以下代码 <resources xmlns:android="http://schemas.android.com/apk/res/android"><style name="mycolor"> <item name="android:background">@layout/header_ 我无法理解AppBasetheme在 Android中会发生什么.
在styles.xml中,我有以下代码
<resources xmlns:androID="http://schemas.androID.com/apk/res/androID"><style name="mycolor">    <item name="androID:background">@layout/header_gradIEnt</item>    <item name="androID:padding">5dip</item></style><style name="myParenttheme" parent="androID:theme.light">    <item name="androID:attr/windowTitleSize">40dip</item>    <item name="androID:attr/windowTitleBackgroundStyle">@style/mycolor</item></style><!-- Application theme. --><style name="Apptheme" parent="AppBasetheme"></style>

在AndroIDManifest.xml中,当我使用androID:theme =“@ style / myParenttheme”时,标题的颜色和大小设置为我想要设置的内容.但是文本字段的样式更改为旧的常规文本框.当我使用androID:theme =“@ style / Apptheme”时,UI看起来非常像“AndroID-like”,但我对标题的具体设置没有任何影响.删除parent =“AppBasetheme”使Apptheme样式的行为与myParenttheme样式相同.

另外,当我在键入Style标签的name属性时执行Ctrl Space时,为什么我看不到所有R.attr元素?

请帮忙.谢谢.

解决方法 如果您选择使用Eclipse新项目向导创建活动,Eclipse将为您定义Apptheme和AppBasetheme资源. AppBasetheme通常有三个定义,res / values /,res / values-v11 /和res / values-v14 /. Apptheme将继承AppBasetheme.

目的是让您将大部分特定于应用程序的样式信息放在Apptheme中,而不是发明自己的主题(例如myParenttheme). AppBasetheme主要确保您继承正确的OS提供的主题(例如,theme.light vs. theme.Holo.light vs. theme.Holo.light.DarkActionbar).如果您愿意,还可以将特定于版本的样式信息添加到相应的AppBasetheme中.

In AndroIDManifest.xml when I use androID:theme="@style/myParenttheme" the color and size of the Title are set to what I want to set. But the style for text fIElds changes to the old regular textBoxes.

那是因为你继承自theme.light,它使用原始(非全息)小部件集.

When I use androID:theme="@style/Apptheme" the UI looks very “AndroID-like” but my specific settings to the Title do not have any effect.

那是因为你决定创建myParenttheme而不是将你的风格定义放到Apptheme中.

总结

以上是内存溢出为你收集整理的AppBaseTheme在Android应用程序中做了什么全部内容,希望文章能够帮你解决AppBaseTheme在Android应用程序中做了什么所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1133929.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存