我有一个 ListView 结构,使用相对布局 奇数/偶数元素的交替背景图像。我正在尝试设置 通过计算位置动态绘制背景。它 使用普通位图效果很好。但是当我尝试使用 ninepatch image 它破坏了用户界面,所有元素都扭曲了。什么 我做错了吗?可能是 ninepatch 图像是如何创建的还是 与普通图像相比,有一种不同的方式来使用 ninepatch 图像 位图。
我的 ListView XML 是这样的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/id01"
android:background="@drawable/my_9patch_bg_image">
<ImageView />
<RelativeLayout>
<ImageView />
<TextView />
<TextView />
</RelativeLayout>
</RelativeLayout>
可能是解决方案here可能适用于我的问题。虽然我必须尝试一下,但它是准确的。
最佳答案
自从一年以来都没有人回答您... 我遇到了同样的问题,您需要将填充设置为零(即使您不需要它)。
祝你好运。
关于android - 以 9 补丁图像作为背景的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5040720/