How can I set emoji in yes no button and submit button ? I'm going to create a feedback app.
Asked
Active
Viewed 988 times
2
-
1Why don't you try by yourself. Try to google it and move a step. Then we can help you. – learner May 23 '16 at 10:40
-
You basically want a custom `Switch`. I'm confident you can use Google for that. – May 23 '16 at 10:40
-
Use TextView and create custom drawable for ovel shape and set this drawble to background of textview and use drwableLeft for set smiley icon on textview.... its work enjoy – Nitesh Pareek May 23 '16 at 10:40
-
Actually , I'm new to android. I need More support from you guys. – nayan May 23 '16 at 10:45
-
Is there any option to apply templates in android? – nayan May 23 '16 at 10:46
-
for future users refer answer : https://stackoverflow.com/a/26894146/884674 – jeet.chanchawat Aug 10 '17 at 07:03
1 Answers
1
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.

baselsader
- 424
- 2
- 4
- 16