<?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); –
我修正了一個錯字。現在試試。 –
我已經修復了錯別字,但仍然出現此錯誤:/ –