我有两个 TextView (TV_1、TV_2)。我想将 TV_2 设置在 TV_1 的右侧。 这意味着
- 假设 TV1 占据了屏幕的一整行,那么 TV2 将设置在 TV1 的下方。
- 假设 Tv1 占据一行半,那么 tv2 将占据剩余的空间。如何实现?我试过了,但我没有得到。它类似于一个段落。
<RelativeLayout
android:id="@+id/xrays_dicom_alert_TnC"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="20dp">
<CheckBox
android:id="@+id/xrays_dicom_alert_cb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/xrays_dicom_alert_TnC_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/xrays_dicom_alert_cb"
android:text="I have read I agree to the following"
android:textColor="@color/black"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/xrays_dicom_alert_statement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/xrays_dicom_alert_cb"
android:layout_below="@id/xrays_dicom_alert_TnC_text"
android:layout_alignRight="@id/xrays_dicom_alert_TnC_text"
android:text="Statement"
android:textColor="@color/black"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
最佳答案
这在 Android 中是不可能的。
View 在屏幕上占据一个矩形区域。
http://www.androidadb.com/class/android/view/View.java.html
或者你必须做这样的事情
要使 TextView 中的某些文本可点击,可以使用 Spannable 概念。 http://developer.android.com/reference/android/text/Spannable.html
关于android - 如何并排排列两个 TextView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10684582/