Android TextView drawable, change padding between drawable and text?

后端 未结 4 683
囚心锁ツ
囚心锁ツ 2020-12-30 18:14

I am creating a TextView with a drawable underneath, in a GridLayout.

I want to bring the drawable to the middle of the TextView

4条回答
  •  没有蜡笔的小新
    2020-12-30 19:02

    You can use layer-list.

    Before:

    Create xml for shape - shape_rectangle.xml :

    
    
    
        
            
            
        
    
    
    

    After:

    In xml, there is something like android:right. You can add also top,left,bottom. This way you can give for example: padding left and right to drawable without resizing total height of textView.

提交回复
热议问题