Answer the question
In order to leave comments, you need to log in
Custom UI in Android
I've been digging a development theme for Androyd for about a week. The following question arose - if I suppose I had to radically change the appearance, for example, of a button - (Button) - how can this be done? It means that I want to use my images and so on.
Answer the question
In order to leave comments, you need to log in
For a Button, you can define your own look by setting images for its different states (pressed / in focus / not pressed):
<Button android:id="@+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="My Text"
android:background="@drawable/mybutton_background"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:state_pressed="false"
android:drawable="@android:drawable/grey_button_background_focus_blue" />
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@android:drawable/grey_button_background_pressed_blue" />
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@android:drawable/grey_button_background_pressed_blue" />
<item android:drawable="@android:drawable/grey_button_background_normal" />
</selector>
Don't forget to dig towards the 9-patch as well. There is an article on habré
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question