我正在开发一个用于创建学生Marklist的应用程序ListView
。在Android中使用TextView,TextView,RadioGroup自定义ListView
在这个应用程序中,列表中有10名学生。为这些学生提供的考试有四个等级。一个学生只能适应四个中的一个。
老师会将分数分配给ListView
中的学生。
我的XML文件Studentlist.xml情况如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
和我row.xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="500dp"
android:layout_height="fill_parent"
android:padding="10dp" >
<TableRow>
<TextView
android:id="@+id/SNo"
style="@style/text"
android:layout_width="40dp"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/StudNo"
style="@style/text"
android:layout_width="80dp"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/StudName"
style="@style/text"
android:layout_width="180dp"
android:layout_height="wrap_content" />
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:checked="true" />
<RadioButton
android:id="@+id/radio1"
android:layout_width="40dp"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/radio2"
android:layout_width="40dp"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/radio3"
android:layout_width="40dp"
android:layout_height="wrap_content" />
</RadioGroup>
</TableRow>
现在我尝试输出的形式如下:
1 0001 AAAA <RadioButton1> <RadioButton2> <RadioButton3> <RadioButton4>
2 0002 BBBB <RadioButton1> <RadioButton2> <RadioButton3> <RadioButton4>
如何使用适配器功能?
ArrayAdapter<String,String,String,RadiGroup> studList=new ArrayAdapter<String,String,String,RadiGroup>();
我可以使用这样的,以及如何开发为ListView
定制适配器?
建议我寻求最佳解决方案!
?常规的LinearLayout或RelativeLayout也适用。 – etienne 2013-04-08 15:33:04
你需要定义一个自定义的适配器,这个目的.http://stackoverflow.com/questions/15832335/android-custom-row-item-for-listview/15832695#15832695 – Raghunandan 2013-04-08 15:35:54
两者都是一样的,对..我们正在取代通过自定义布局在列表视图中列出项目。在这里LinearLayout和TableLayout是一样的,我们可以使用任何东西。告诉我一个关于LinearLayout解决方案的建议。 – user2258206 2013-04-08 15:36:27