Everytime I try to add some drawable icons to a button they are not displayed even if it's a button or a Material Button
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Person"
android:drawableStart="@drawable/ic_person_pin_circle_black_24dp"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Package"
android:layout_marginStart="10dp"
android:drawableStart="@drawable/ic_business_center_black_24dp"
/>
In the left I have the "pin person" icon and the "briefcase " icon, but on the layout aren't display. Do you know what might cause this?
drawableStart corresponds to the drawable that will be draw to the begenning of the view according to the layout direction, but your direction could be bad ; you can change this direction like that :
android:gravity="center_vertical|center_horizontal|left"
or you can add them programmatically :
myButton.setCompoundDrawablesRelativeWithIntrinsicBounds(
ContextCompat.getDrawable(this, R.drawable.ic_business_center_black_24dp), null, null, null);