Reputation: 147
I created button with text and icon:
<Button
android:id="@+id/btnLinkToProfile"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="@string/profile"
android:gravity="left|center_vertical"
android:textAllCaps="false"
android:textColor="@color/text"
android:textSize="15dp"
android:drawableLeft="@drawable/profile"/>
And I want to set icon color, how to do this in <Button/>
tag or it can be set only in <ImageView/>
tag?
Upvotes: 3
Views: 4915
Reputation: 94
You can use the android:drawableTint="#000000" for the drawable like
<Button
android:id="@+id/btnLinkToProfile"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="@string/profile"
android:gravity="left|center_vertical"
android:textAllCaps="false"
android:textColor="@color/text"
android:textSize="15dp"
android:drawableLeft="@drawable/profile"
android:drawableTint="#000000"
android:drawableTintMode="src_in"/>
Thank you
Upvotes: 4
Reputation: 108
You can use an ImageButton and set the colour with
android:tint="@color/myColour"
Upvotes: 1