I'm creating a background image for an Android app.
The App should run on all devices so the background image will be tiled.
However I would like that the background fit开发者_运维百科s exactly on a 240x400 pixels (WQVGA), 3.2'' TFT LCD (Archos32' screen size).
So I've created a backgorund image of 240x400 pixels and placed it in the drawable-ldpi folder. Then I started an emulator with WQVGA resolution and 120dpi. My background image fit exactly on the horizontal axis but it's cropped on the vertical one.
So my question is: what's the right resolution for the background image on a 240x400 ldpi device?
If as you said your image is to be tiled then you can just create an xml to tile the image to any screensize
filename: /res/drawable/striprepeat.xml
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/stripe"
android:tileMode="repeat"
/>
and I have a stripe background image (/res/drawable/stripe.png) which has res of 22x22
Copy the image in all drawable folders, and use "wrap_content
" in height and width properties. avoid specifying numbers in xml, rather use wieghts.
精彩评论