Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we use CSS in Android forms for android components?

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

Thanks Atif

like image 556
Muhammad Atif Agha Avatar asked Jul 27 '11 11:07

Muhammad Atif Agha


People also ask

Can I use CSS in Android Studio?

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

How can I use CSS in Android?

First, create an Android Application Project in Eclipse. Then open the Layout XML file. Drag the first Linear Layout then WebView Element to the Relative Layout of the Activity. Then make a HTML and CSS file.

Can I use HTML and CSS in Android Studio?

The Short answer: Yes, you can develop apps using HTML / CSS / Javascript.

How do I style in Android Studio?

Create and apply a style To create a new style or theme, open your project's res/values/styles.xml file. For each style you want to create, follow these steps: Add a <style> element with a name that uniquely identifies the style. Add an <item> element for each style attribute you want to define.


2 Answers

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.

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.

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.

  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
like image 104
Paresh Mayani Avatar answered Sep 29 '22 17:09

Paresh Mayani


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

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

Or a completely new way to write app, NativeScript

like image 43
Light Avatar answered Sep 29 '22 17:09

Light