Hi I am a beginner in android and I want to know how to customize buttons,check box etc., I searched in web but found many ways and got confused... Can you please tell me what are the ways to customize android widgets, can we do that using css, like we do for the HTML? Thanks in advance...
Asked
Active
Viewed 77 times
1
-
what you mean by customize ? what excatly you want to do ? – Feb 19 '14 at 06:50
-
In my idea idea it includes changing backgrounds of buttons, edittexts vice versa... – srujan maddula Feb 19 '14 at 08:24
1 Answers
1
There are a few ways. You can use 9patch to edit the files inside the SDK(which will typically be C:\Android\SDK\platforms\android-19\data\res\drawable-hdpi) - Android-19 is the api level, and then set them in your xml layout under the widget you want with
android:background="@drawable/your file"
Another way is to create a selector(Recommended because it can handle stuff like when clicked and more), shape(Simple creation with corners and stuff), layer list(Advanced selector) or solid(just a color) in /drawable and then set them in your xml under the widget you want with
android:background="@drawable/your file"
An example of the second solution can be found here android button selector