Set background image tile for Android

Source: Internet
Author: User

Taking linearlayout as an example, the background attribute provided by linearlayout will stretch the background image, which is rather ugly. In fact, we only need to make a few modifications to achieve the effect of CSS background images in Web programming. Let's try it.
Create duplicate background images
Create a repeat_bg.xml file in the drawable directory:

<? XML version = "1.0" encoding = "UTF-8"?> <Bitmap xmlns: Android = "http://schemas.android.com/apk/res/android" Android: src = "@ drawable/BG" Android: tilemode = "repeat"/>

Then, you can reference the layout in the XML file as follows:

<Linearlayout Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: Background = "@ drawable/repeat_bg"> </linearlayout>

All rights reserved. If you need to reprint it, indicate the source. Thank you for your cooperation. Shenyang -- binzi.

Note: QQ technology exchange group: add one if you are interested in 108614806.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.