我们可以在Android表单中为CSS组件使用CSS吗?

问题描述:

无论如何,可以将css用于android控件,我们可以为类似的控件创建类吗?

is there anyway to use css for android controls, and can we make classes for similar controls.

谢谢 Atif

为什么要为Android视图定义CSS?首先让我知道这个问题的答案,否则我想告诉你,您可以在

Why do you want to define CSS for the Android views? First let me know the answer of this question, otherwise i would like to tell you that you can defines the same kind of styles inside the styles.xml file and then can implement for any views inside the xml layout file.

例如:

<?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布局文件时,将习惯于轻松地为不同视图定义样式.

At initial level, you face some difficulty but later on as you became aware about defining xml layout file, you will be used to define styles for different views easily.

根据您在下面的评论,我可以说您对android中的样式和主题了解不多,所以我想在下面的链接中为您提供建议,以了解要在android中应用的样式/主题.

As per your comment below, i can say you are not knowing much more about styles and theme in android, so i would like to suggest you below links to know about styles/theme to apply in android.

  1. http://developer.android.com/guide/topics/ui/themes.html
  2. http://android- pro.blogspot.com/2010/08/using-themes-and-styles-in-android.html
  1. http://developer.android.com/guide/topics/ui/themes.html
  2. http://android-pro.blogspot.com/2010/08/using-themes-and-styles-in-android.html