2012-05-21 62 views
1

我有兩個文本視圖(TV_1,TV_2)。我想設置TV_2是TV_1的直接權利。 這意味着android - 如何安排兩個textview並排

  1. 假設TV1佔據屏幕上的一整行,然後TV2將設置在TV1下面。
  2. 假設Tv1佔據一行半,那麼tv2將佔據空間的其餘部分。如何實現這一點?我嘗試過,但我沒有得到。它與一段相似。

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

請發佈您的佈局xml文件。 –

+0

你爲什麼要這樣?你也可以使用單個文本視圖來做到這一點,因爲我看到你的XML。 –

+1

我想設置第二個文本視圖是可點擊的。 – naresh

回答

2

那在Android中是不可能的行爲。

視圖佔據屏幕上的矩形區域。

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

或者你必須做這樣的事情

enter image description here

要點擊在TextView的一個一些文字可以Spannable概念去。 http://developer.android.com/reference/android/text/Spannable.html

使用URLSpanhttp://www.androidadb.com/class/ur/URLSpan.html

+0

我認爲它是在瀏覽器中打開,但我想打開使用web視圖如何做到這一點? – naresh

1

我認爲這是不可能的格局你問什麼。