Align drawable image inside a text view to center

前端 未结 6 1357
挽巷
挽巷 2021-02-19 11:58

I have a textview which holds an image and some text.

programmatically i have added the drawable image to the left side of text view

txtIDFav.setCompound         


        
6条回答
  •  生来不讨喜
    2021-02-19 12:50

    it is not possible to set image in background of text view instead of this you can set your drawable on textview like this

    android:drawableRight="@drawable/ic_launcher"

    "or"

    android:drawableleft="@drawable/ic_launcher"

    "or"

    android:drawableBottom="@drawable/ic_launcher"

    only for your problem's solution you can use texview inside the framelayout in this way

       
    
    
    
        
    
    
    

提交回复
热议问题