User Interface Customization Guide

I want to develop an Android application, but I do not want to use the default controls (buttons, check boxes, radio buttons, etc.). Is there a way to tweak these controls to make them look better. If so, then some textbook or manual will help me a lot. Thanks....

+6
android
source share
1 answer

If you want to create completely new user interface elements, you should read the section on creating custom components / views .

If, on the other hand, you just want to change the look of existing user interface elements, the following is an incorrect list of things you will need to do. It is assumed that you are familiar with the Android resource infrastructure and layout system.

  • First, see how they are implemented in the Android source code ( AOSP , GitHub Mirror ). All the code that interests you is in the frameworks/base.git (quick links: resources , Java sources )

  • For each type of user interface element, create Nine Patch PNG drawables for each of the user interface states (default, disabled, pressed, focused, etc.) and for each corresponding density (for example, medium, high, and ultra-high density). These PNGs should be in your res/drawable-mdpi/ , res/drawable-hdpi/ and res/drawable-xhdpi/ .

  • For each type of user interface element, create a list of displayed XML files ( <selector> ), which will be in your res/drawable/ . The list of states available for the default Android button can be found here .

  • Set your button / text box / etc. android:background attribute for list name. For example, the attribute value should be @drawable/mybutton if your state list is available res/drawable/mybutton.xml .

    Note. You can use themes to reduce redundancy (i.e. keep them DRY ) in your XML files.

+15
source share

All Articles