我想在我创建的布局中沿x方向有平铺背景。我已经按照在线发现的一些很好的说明来正确拼贴,但源图像现在垂直伸展很好。我认为这与位图文件类型的性质有关。Android平铺背景图片:使用位图调整图片大小?
例图片:
第一图像是平铺之前的背景图像。第二张图片是在平铺之后。正如你所看到的,图像垂直伸展很好,并且由于调整大小,图像也显得有些模糊。
我试过把图像放在drawable-hdpi和drawable文件夹中。我已经尝试将XML文件放在两个文件夹中。这似乎没有关系。
下面是产生这些两个图像的布局的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/bg" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/bg_repeat" />
</LinearLayout>
“@绘制/ BG”是实际的图像本身,bg.png。 “@ drawable/bg_repeat”是以下位图XML文件:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/cdetail_bg_unclaimed_details"
android:antialias="false"
android:dither="false"
android:filter="false"
android:gravity="center|center_vertical"
android:tileMode="repeat" />
对于x-repeat平铺,是否有替代方案?或者有没有一些解决方法,我还没有检查?我已经更改了抗锯齿,抖动,滤镜等所有选项。没有任何东西可以改变。
感谢您的帮助!
编辑:这似乎是一个使用图形布局工具的错误。它在我的手机上看起来不错。