2013-03-26 51 views
-3

我在groupView中有幾個單選按鈕,每個單選按鈕都有自己的文本。如果此文本有多行,那麼此文本的單選按鈕與文本居中對齊,但我想將單選按鈕對齊到其文本的頂部。RadioButton文本在組視圖

我的目標: -

我:

| text line 1 

RB | text line 2 

    | text line 3 

我想:

 RB  
| text line 1 

| text line 2 

| text line 3 

有關設置文本我使用rb.setText(文本);

+0

好吧......我不明白這是怎麼回事...... – 2013-03-26 11:45:37

+0

您應該編輯您的問題,而不是發佈您的需求作爲一個答案。 – Nitish 2013-03-26 11:49:28

+0

我會建議你刪除你的答案,因爲我已經更新了你的問題。這將有助於避免對其他人造成混淆,並且您可以投票表決:) – DeltaCap 2013-03-26 11:58:27

回答

1

你可以試試這個方法:

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" > 

    <RadioButton 
     android:id="@+id/rb1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

    <TextView 
     android:id="@+id/tv1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/test_text" /> 
</LinearLayout> 
+0

是的,這是一種方式。我想知道是否可以用單選按鈕文本屬性來做到這一點。 – 2013-03-26 12:19:34

+1

如果你想使用屬性來代替textview和radiobutton建立linearlayout,然後設置單選按鈕的重力TOP。 – 2013-03-26 12:34:47