I an trying to use Imageview
to overlay a bitmap over a layout.
From what I can see.
android:src
it does not get streched to cover the layoutandroid:background
it gets strechedMy dilemma is that I want to use a bunch of 9-patchs in a level-list
resource and select the right one using setImageLevel()
.
android:src
and not for android:background
How do I get the 9-patch also streched but also selectable from level-list?
You can use your level-list
drawable. That drawable will be the background for the ImageView
, to set the level to the desired value(and to make the proper drawable be selected) you'll use:
LevelListDrawable background = (LevelListDrawable) findViewById(R.id.image).getBackground();
background.setLevel(1);