<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.innoversetech.hobuddies.MainActivity"
android:background="#FF7506"
android:id="@+id/linMatcher">
<ScrollView
android:id="@+id/scroll"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lin1">
<!-- Psychometric Questions-->
<TextView
android:layout_width="wrap_content"
android:layout_height="37dp"
android:id="@+id/Surgency1"
android:textSize="20sp"
android:text="I am the life of the party"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/Surgency1"
android:orientation="vertical">
<!--Radio Buttons-->
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Strongly Disagree"
android:id="@+id/SD"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Disagree"
android:id="@+id/D"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Not really"
android:id="@+id/NR"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Agree"
android:id="@+id/A"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Strongly Agree"
android:id="@+id/SA"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
我想要的是用相似的单选按钮创建15个问题。有没有办法让我创建一个单选按钮布局,然后调用它?我不必一次又一次复制粘贴单选按钮。另外我怎样才能定义每个ID的不同?有没有办法在另一个布局中调用已定义的布局?
我在这两条线得到错误(无法解析符号“膨胀”,不能解析符号“第一”和“seconf”) inflater.inflate (R.layout.radio_q1.xml,first,true); inflater.inflate(R.layout。radio_q1.xml,second,true); –
我修正了一个错字。现在试试。 –
我已经修复了错别字,但仍然出现此错误:/ –