How to add image(left) and text on button

后端 未结 3 1726
天命终不由人
天命终不由人 2021-02-03 23:02

How to add image(left) and text on button?


For illustration:

\"enter

3条回答
  •  一个人的身影
    2021-02-03 23:46

    use android:drawableLeft="@drawable/image" in your layout xml

    you can also do this from code

    Drawable icon= getContext().getResources().getDrawable( R.drawable.image);
    button.setCompoundDrawablesWithIntrinsicBounds( icon, null, null, null );
    

提交回复
热议问题