我们能在Android的表单中使用CSS吗?

时间:2022-01-14 01:08:00

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

是否有css用于android控件,我们是否可以为类似控件创建类。

Thanks Atif

谢谢你爱

3 个解决方案

#1


12  

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.

为什么要为Android视图定义CSS ?首先让我知道这个问题的答案,否则我想告诉你,你可以在风格中定义相同类型的风格。xml文件,然后可以实现xml布局文件中的任何视图。

For example:

例如:

<?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>

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.

在最初的层次上,您会遇到一些困难,但是随着您逐渐了解如何定义xml布局文件,您将很容易地为不同的视图定义样式。

Update:

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.

根据你下面的评论,我可以说你对android的风格和主题了解的不多,所以我建议你在下面的链接中了解一下android的风格/主题。

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

#2


4  

Maybe you can try Nativecss. It's a libary that you can use css-like selectors in android layout.

也许你可以试试Nativecss。它是一个libary,您可以在android布局中使用类似css的选择器。

--------- Updated on May 10th, 2015 -----------

-----更新于2015年5月10日------

Or a completely new way to write app, NativeScript

或者是一种全新的应用程序,NativeScript。

#3


1  

you can define Styles and Themes, but if you want to use CSS you need a HTML form which you can show in a Native Android WebView (an idea on which phonegap platform runs)

您可以定义样式和主题,但是如果您想使用CSS,您需要一个HTML表单,您可以在本地的Android WebView中显示它(一个关于phonegap平台运行的想法)

#1


12  

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.

为什么要为Android视图定义CSS ?首先让我知道这个问题的答案,否则我想告诉你,你可以在风格中定义相同类型的风格。xml文件,然后可以实现xml布局文件中的任何视图。

For example:

例如:

<?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>

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.

在最初的层次上,您会遇到一些困难,但是随着您逐渐了解如何定义xml布局文件,您将很容易地为不同的视图定义样式。

Update:

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.

根据你下面的评论,我可以说你对android的风格和主题了解的不多,所以我建议你在下面的链接中了解一下android的风格/主题。

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

#2


4  

Maybe you can try Nativecss. It's a libary that you can use css-like selectors in android layout.

也许你可以试试Nativecss。它是一个libary,您可以在android布局中使用类似css的选择器。

--------- Updated on May 10th, 2015 -----------

-----更新于2015年5月10日------

Or a completely new way to write app, NativeScript

或者是一种全新的应用程序,NativeScript。

#3


1  

you can define Styles and Themes, but if you want to use CSS you need a HTML form which you can show in a Native Android WebView (an idea on which phonegap platform runs)

您可以定义样式和主题,但是如果您想使用CSS,您需要一个HTML表单,您可以在本地的Android WebView中显示它(一个关于phonegap平台运行的想法)