背景图片不重复在Android的布局 [英] background image not repeating in android layout

查看:164
本文介绍了背景图片不重复在Android的布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code重复图像的背景,但它不工作任何一个可以帮助?

i've used the following code to repeat the image in the background but its not working can any one help?

Layout.xml

Layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/grass_bg"
    >

grass_bg.xml在绘制看起来像这样

grass_bg.xml in drawable looks like this

<?xml version="1.0" encoding="utf-8"?>
    <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/grass_small"
        android:tileMode="repeat"/>

它显示了相同的小图像。它不是重复......

its showing the same small image. its not repeating...

推荐答案

在每次使用时间创建的 grass_bg.xml 副本(即 grass_bg_2.xml )。这为我工作,以保证 TILEMODE 设置时不会丢失时,相同的背景是反复使用。

Create a copy of grass_bg.xml for each time you use it (ie grass_bg_2.xml). This worked for me to assure the tileMode setting was not lost when the same background is used repeatedly.

这篇关于背景图片不重复在Android的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆