naresh
naresh

Reputation: 10392

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.

enter image description here

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

Upvotes: 1

Views: 1578

Answers (2)

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

enter image description here

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

Upvotes: 2

code_finder
code_finder

Reputation: 1370

I think it's not possible in the pattern what you have asked.

Upvotes: 1

Related Questions