gpt4 book ai didi

Android以编程方式在TextView中添加按钮

转载 作者:行者123 更新时间:2023-12-05 00:22:10 25 4
gpt4 key购买 nike

我要添加 ButtonTextView 中的文本中间,例如当我在文本中看到电话号码时,将其替换为 ButtonTextView ,并设置Button的背景到联系人图片,但我如何添加 ButtonTextView ?可能吗 ?

 <TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

最佳答案

您正在谈论在小部件中放置小部件(或 View )。这是不可能的。您只能在布局内添加小部件。但是,如果您将使用相对布局,则可以将一个小部件放置在另一个小部件之上。

引用:developer.android.com/guide/topics/ui/declaring-layout.html

关于Android以编程方式在TextView中添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26584054/

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