Android Yes No Button emoji

1k Views Asked by At

How can I set emoji in yes no button and submit button ? I'm going to create a feedback app.

I need to create a form like this :

1

There are 1 best solutions below

0
baselsader On BEST ANSWER

These seem like a Buttons with custom background and a drawable. Simply create a Button

        <Button
            android:id="@+id/yes"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableStart="@drawable/emoji"
            android:drawableLeft="@drawable/emoji"
            android:background="@drawable/yes_background"
            android:text="@string/yes" />

And then create a drawable in your drawables folder, named "yes_background", as such

<selector xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:drawable="@drawable/button_selected" android:state_selected="true" />
 <item android:drawable="@drawable/button_pressed" android:state_pressed="true" />
 <item android:drawable="@drawable/button_normal" />
</selector>

In your drawable folders, create another three drawables, for "button_selected", "button_pressed", "button_normal", and colour them in whichever you would like. For example, "button_selected" could be:

 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <solid android:color="@color/blue" />
 </shape>

Do the same for the no button and the submit button.