简体   繁体   中英

android - How to arrange the two textviews side by side

I have two text views(TV_1,TV_2).I want to set the TV_2 is immediate right of the TV_1. It means

  1. suppose TV1 occupy the one entire line in the screen then TV2 will set below the TV1.
  2. Suppose Tv1 occupy the one and half line then tv2 will occupy the rest of the space. How to implement this? i tried but i am not getting. It is similar to one paragraph.

在此输入图像描述

    <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>    

Thats impossible act in Android.

A View occupies a rectangular area on the screen.

http://www.androidadb.com/class/android/view/View.java.html

Or you have to do something like this

在此输入图像描述

To make clickable some text in TextView one can go with Spannable concept. http://developer.android.com/reference/android/text/Spannable.html

use URLSpan http://www.androidadb.com/class/ur/URLSpan.html

我认为你所要求的模式不可能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM