开发者

dimensions of a background image

i have an xml file with a scrollview.i would like to have an image for background but i tr开发者_开发百科ied it in many image size and it pixelates..what would be the best dimensions of the image in order to use it as background ?thanks


Have you tried using fill_parent or wrap_content? your question is still a little unclear. try android:background="@drawable/ur_image" from res folder.


I would create a style:

<style name="styBackground">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">fill_parent</item>
    <item name="android:src">@drawable/default_background</item>
    <item name="android:scaleType">centerCrop</item>
</style>

And apply it to every screen you want the background on:

<ImageView
    style="@style/styBackground"
    />

The centerCrop will guarantee that it doesn't stretch, and the fill_parent's cause the image to fill the screen, but not more than necessary. For pixelation, make sure your image is large enough to support the highest resolution on the market, like 854x480.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜