<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_margin="20dp"
android:hint="@string/str_name" />
<TextView
android:id="@+id/tvSentence"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="@string/str_hello1"/>
我希望将 et_name 添加到 @string/str_hello1 行。我试过这个:
<TextView
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="@string/str_hello1" + "@+id/et_name"
和
android:text="@string/str_hello1" + et_name
和
android:text="@string/str_hello1" + "et_name"
但是它们都不起作用,现在所有内容都用红色下划线表示意外的文本。
你必须以编程方式从 java 端或 kotlin 中完成它,你不能在 xml 中做到这一点