Prevent background image from stretching the view

后端 未结 6 1372
予麋鹿
予麋鹿 2021-02-18 12:36

Whenever I assign background to a view that is laid out with wrap_content, if the background image is larger than a view, the view is stretched so that it can hold the entire ba

6条回答
  •  你的背包
    2021-02-18 13:19

    You can use RelativeLayout and create two elements inside it. An ImageView for the Background and another view for your content. Use the android:layout_alignBottom to the the ImageView and set the value to the id of your content view. Also set the scaleType of the ImageView to fitXY.

    
    
    
    
    
    
    
    

提交回复
热议问题