android背景重复-y
我有一个图像,我想定位在右边,并在y轴上重复它。 类似于HTML中的“background:url(img.png)right repeat-y” 在安卓系统中有可能做到这一点吗 当我将此位图设置为背景时,它不在右侧:android背景重复-y,android,background,gravity,Android,Background,Gravity,我有一个图像,我想定位在右边,并在y轴上重复它。 类似于HTML中的“background:url(img.png)right repeat-y” 在安卓系统中有可能做到这一点吗 当我将此位图设置为背景时,它不在右侧: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/img_list" android:filter="true" android:d
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/img_list"
android:filter="true"
android:dither="true"
android:tileMode="repeat"
android:gravity="right" />
我使用以下代码在y轴上重复图像作为背景:
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/background"
android:tileMode="repeat"
android:antialias="true"
android:dither="false"
android:filter="false"
android:gravity="left"
/>
好的,但我想将背景设置为“右边缘”,但当我将tileMode设置为“重复”时,重力属性被忽略并设置为“左A”,现在我明白了,我尝试了一些东西,但还没有找到解决方案。。我想一定有办法将tilemode设置为x和y分开,但还没有找到。现在需要走了,希望其他人很快会回答你的问题。我想你已经找到了答案,但我已经用一个可行的答案更新了我的答案。。只能在代码中设置单独的TileMode..BitmapDrawable不推荐使用,有其他选择吗?只有构造函数不推荐使用,才能使用:BitmapDrawable BitmapDrawable=new BitmapDrawable(getResources(),BitmapFactory.decodeResource(getResources(),R.drawable.tile_image));
BitmapDrawable TileMe = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.listbackground));
//TileMe.setTileModeX(TileMode.REPEAT);
TileMe.setTileModeY(TileMode.REPEAT);