gpt4 book ai didi

android - 9-patch 无效

转载 作者:行者123 更新时间:2023-11-30 02:49:09 25 4
gpt4 key购买 nike

我创建了 2 9 个补丁图像,其中 1 个工作正常,1 个不工作。尝试创建它超过 10 次,但一切都失败了。不知道原因,这就是为什么需要社区的帮助。

This is working perfect

Not working

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" >

<RelativeLayout
android:id="@+id/rlContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/imgPhoto"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@id/imgPhoto"
android:background="@drawable/bubble"
android:visibility="visible" >

<TextView
android:id="@+id/txtMessageDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yesterday 4:25 PM"
android:textColor="@android:color/black"
android:textSize="12sp" />

<TextView
android:id="@+id/txtMessageSnippet"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtMessageDate"
android:layout_marginTop="5dp"
android:text="How are you?"
android:textColor="@android:color/black"
android:textSize="14sp" />
</RelativeLayout>

// This is not workin - the light blue one

<RelativeLayout
android:id="@+id/rlContentOwner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/imgPhotoOwner"
android:layout_below="@id/rlContent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@id/imgPhotoOwner"
android:background="@drawable/new_right_side_bubble"
android:padding="0dp"
android:visibility="visible" >

<TextView
android:id="@+id/txtMessageDateOwner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="yesterday 4:37 PM"
android:textColor="@android:color/black"
android:textSize="12sp" />

<TextView
android:id="@+id/txtMessageOwner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtMessageDateOwner"
android:layout_marginTop="5dp"
android:text="I am fine"
android:textColor="@android:color/black"
android:textSize="14sp" />
</RelativeLayout>

</RelativeLayout>

最佳答案

你不需要这么大的 9 个补丁,因为它们会被拉伸(stretch)。
我像这样重新设计了它们:

speech_left.9.png enter image description herespeech_rite.9.png enter image description here

这是我得到的结果(我只展示了天蓝色的):

enter image description here

关于android - 9-patch 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24508611/

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