Android 对齐收音机组中的多行文字
我正在开发一个测验应用程序,在这个应用程序中,我必须显示4个单选按钮和一些多行文本,就像在快照中一样。为此,我使用了单选组,但问题是单选按钮没有与快照中显示的文本正确对齐。它变成了hosh pash。请提供一些建议。提前谢谢 这是我的layout.xmlAndroid 对齐收音机组中的多行文字,android,radio-button,Android,Radio Button,我正在开发一个测验应用程序,在这个应用程序中,我必须显示4个单选按钮和一些多行文本,就像在快照中一样。为此,我使用了单选组,但问题是单选按钮没有与快照中显示的文本正确对齐。它变成了hosh pash。请提供一些建议。提前谢谢 这是我的layout.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/to
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/txtQ"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/screen"
android:orientation="vertical"
tools:context=".MainActivity" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textQno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1" />
<TextView
android:id="@+id/textRem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:gravity="right"
android:text="1" />
</LinearLayout>
<TextView
android:id="@+id/textQuis"
android:layout_width="fill_parent"
android:layout_height="144dp"
android:text="TextView" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/rbQ1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/rbQ2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/rbQ3"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/rbQ4"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="fill" >
<Button
android:id="@+id/bMainPre"
style="@style/ButtonText"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_blue"
android:text="@string/bPrev" />
<Button
android:id="@+id/bMainNext"
style="@style/ButtonText"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_blue"
android:text="@string/bNext" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill" >
<Button
android:id="@+id/bshowAnswer"
style="@style/ButtonText"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_blue"
android:text="@string/bShow" />
<Button
android:id="@+id/bSubAns"
style="@style/ButtonText"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_blue"
android:text="@string/bsumit" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
执行此操作可将对齐的文本添加到单选按钮:
<RadioButton
android:id="@+id/rbQ1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="YOUR TEXT HERE"
android:gravity="center"
android:layout_gravity="center"
android:layout_margin="5dip" />
无法使用收音机组执行此操作??请参阅我的编辑。你可以向单选按钮添加文本,因为它是文本视图的扩展。我知道。实际上,文本来自服务器,我通过setText()方法将其动态设置为单选按钮