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?
android:scaleType="fitXY" android:scaleType="centerCrop"- Alexey ShtankogetWindow().setBackgroundDrawableResource(R.drawable.bg_image);to set the background image. Inbg_imageyou cannot useandroid:scaleTypeas you can, but I don't know. For this, I created this question - nesalexy