Reputation: 4101
I created a 9patch image and somehow it does only stretch vertically. I tried other 9-patch images, but they have the same effect, whyle they work in other situations. So the 9patch should be fine I think. This is my XML code:
..
<ImageView
android:id="@+id/bottombar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:contentDescription="@string/app_name"
android:src="@drawable/bar" />
</RelativeLayout>
Anybody had the same issue and know how to solve it?
Thanks
Upvotes: 2
Views: 2243
Reputation: 72341
If you are sure that the height
of your View
is really taller than the current image
(as the others have suggested) then you should change your ImageViews
scaleType
. The default is FIT_CENTER
which does not stretch the image, you should set it to FIT_XY
.
Also you may try to set your 9-png file as the background of your ImageView
not as the src
and I think this will also stretch the file.
Upvotes: 9
Reputation: 60721
You have wrap_content
specified for the height. Are you sure the content is tall enough to make the image stretch?
Upvotes: 0
Reputation: 53687
The issue may be in layout_width="match_parent"
you have mentioned width to match parent this may be the reason of 9 patch image to stretch vertically. But for height you have written height="wrap_content"
So it doesnt stretch in height
Upvotes: 0
Reputation: 427
Did you add a black dot to the top dead center as well as the left side center?
Upvotes: 0