gpt4 book ai didi

android - 如何在多行 TextView 的最后一个字之后添加图像?

转载 作者:行者123 更新时间:2023-11-30 01:16:31 25 4
gpt4 key购买 nike

我正在使用一个餐厅应用程序,我想在食物名称后面添加 Veg Non-Veg 图片。我使用了相对布局但无法实现。 See Image我想实现这一目标。提前致谢。

最佳答案

尝试使用像这样的自定义 View ;

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/item_name"
android:layout_weight="1"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/item_image"/>
</LinearLayout>

然后您的应用程序将需要一个适配器来显示列表中的内容或您想要显示的任何 View 。

关于android - 如何在多行 TextView 的最后一个字之后添加图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37794316/

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