无论如何,有没有办法为 android 控件使用 css,我们可以为类似的控件创建类吗?
谢谢
阿蒂夫
为什么要为 Android 视图定义 CSS?首先让我知道这个问题的答案,否则我想告诉你,你可以在样式.xml http://developer.android.com/guide/topics/ui/themes.html文件,然后可以为 xml 布局文件内的任何视图实现。
例如:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
</style>
</resources>
在初始阶段,您会遇到一些困难,但后来当您意识到定义 xml 布局文件时,您将习惯于轻松地为不同视图定义样式。
Update:
根据您下面的评论,我可以说您对 Android 中的样式和主题了解不多,所以我想建议您通过以下链接了解有关在 Android 中应用的样式/主题。
- http://developer.android.com/guide/topics/ui/themes.html http://developer.android.com/guide/topics/ui/themes.html
- http://android-pro.blogspot.com/2010/08/using-themes-and-styles-in-android.html http://android-pro.blogspot.com/2010/08/using-themes-and-styles-in-android.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)