I want to develop an android application, but i dont want to use the default controls(buttons, checkboxes, radio buttons, etc.,). Is there any way to customize those controls to
If you want to create completely new UI elements, you should read the developer guide topic on creating custom components/views.
If, on the other hand, you simply want to change the appearance of existing UI elements, below is a non-exhaustive list of things you'll need to do. This assumes you're familiar with the Android resources framework and layout system.
First, see how these are implemented in the Android source code (AOSP, GitHub's mirror). All of the code you're interested in is in the frameworks/base.git
project (quick links: resources, Java sources)
For each type of UI element, create Nine Patch PNG drawables for each of the UI states (default, disabled, pressed, focused, etc.) and for each relevant density (e.g. medium, high , and extra-high densities). These PNGs should be in your res/drawable-mdpi/
, res/drawable-hdpi/
, and res/drawable-xhdpi/
directories.
For each type of UI element, create a state list XML drawable (<selector>
), which will be in your res/drawable/
directory. The state list drawable for the default Android push button can be found here.
Set your button/textbox/etc.'s android:background
attribute to the state list drawable name. For example, the attribute value should be @drawable/mybutton
if your state list drawable is res/drawable/mybutton.xml
.
Note: You can use themes to reduce redundancy (i.e. keep them DRY) in your XML files.