Aligning drawableLeft with text of button

后端 未结 14 1970
长情又很酷
长情又很酷 2021-01-30 06:41

Here is my layout:

\"enter

The issue I\'m facing is with the drawable checkmark. H

14条回答
  •  既然无缘
    2021-01-30 07:19

    Solution 1

    Set android:paddingLeft inside your first button. This will force the drawableLeft by paddingLeft amount to the right. This is the fast/hacky solution.

    Solution 2

    Instead of using a ButtonView, use a LinearLayout that contains both a textview and imageview. This is a better solution. It gives you more flexibility in the positioning of the checkmark.

    Replace your ButtonView with the following code. You need the LinearLayout and TextView to use buttonBarButtonStyle so that the background colors are correct on selection and the text size is correct. You need to set android:background="#0000" for the children, so that only the LinearLayout handles the background coloring.

    
        
        
    
    

    Here are some screenshots I took while trying this out.

    enter image description here enter image description here enter image description here

提交回复
热议问题