I want to set the background image on the layout using getWindow() like this:

getWindow().setBackgroundDrawableResource(R.drawable.bg_image);

and my bg_image

 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/bg_shkaf" /> </item> </layer-list> 

but the picture turns out to be stretched. Is there some property of something like CenterCrop that CenterCrop make the picture look normal?

  • Picture under the screen size? - Alexey Shtanko
  • @AdamLuisSean is not, it is a bit smaller. Because of this stretched. And how to make it look good, have some properties? - nesalexy
  • there are properties for ImageView android:scaleType="fitXY" android:scaleType="centerCrop" - Alexey Shtanko
  • @AdamLuisSean Thanks for the tip, but I wrote in question that I was using getWindow().setBackgroundDrawableResource(R.drawable.bg_image); to set the background image. In bg_image you cannot use android:scaleType as you can, but I don't know. For this, I created this question - nesalexy

0