srujan maddula
srujan maddula

Reputation: 1190

How to customize android widgets

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

Upvotes: 1

Views: 91

Answers (1)

Orphamiel
Orphamiel

Reputation: 884

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

Upvotes: 1

Related Questions