Android Button Drawable Tint -


is possible tint drawableleft in android button? have black drawable i'd tint white. know how achieve image view (image on left) want default android button.

enter image description here

my source code:

<button android:layout_height="wrap_content"         android:layout_width="0dp"         android:layout_weight="1"         android:text="@string/drawer_quizzes"         android:backgroundtint="@color/md_light_green_500"         android:statelistanimator="@null"         android:textcolor="#fff"         android:textsize="12dp"         android:fontfamily="sans-serif"         android:drawableleft="@drawable/ic_action_landscape"         android:gravity="left|center_vertical"         android:drawablepadding="8dp"         /> 

is there way tint button? or there custom view method achieve effect?

you can achieve coloring drawableleft on button method:

step 1: create drawable resource file bitmap parent element shown below , name ic_action_landscape.xml under drawable folder

<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android"     android:src="@android:drawable/ic_btn_speak_now"     android:tint="@color/white" /> 

step 2: create button control in layout below

<button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:backgroundtint="@color/md_light_green_500"         android:drawableleft="@drawable/ic_action_landscape"         android:drawablepadding="8dp"         android:fontfamily="sans-serif"         android:gravity="left|center_vertical"         android:statelistanimator="@null"         android:text="@string/drawer_quizzes"         android:textcolor="#fff"         android:textsize="12dp" /> 

the button gets drawable ic_action_landscape.xml drawable folder instead of @android:drawable or drawable png(s).

method 2:
step 1:
can add icon action bar , tab icons foreground image can imported custom location or clipart

step 2:
under theme dropdown select custom

step 3:
select color #ffffff in foreground color selection. method 2 pictorial representation

finally finish wizard add image, add drawable image.

pictorial representation answer question


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -