gpt4 book ai didi

android - 以 9 补丁图像作为背景的问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:17:53 25 4
gpt4 key购买 nike

我有一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com