我已经从解析的列表视图中显示了数据,应该显示的数据是用户名作为项目和该用户的血型作为子项目。我的应用程序正在显示该项目,但我只是不知道如何显示子项目。解析中的字段名称是“用户名”和“BloodGroup”。请问如何显示子项目。
这是代码
public class donar_list extends Activity {
// Declare Variables
ListView listview;
SimpleCursorAdapter adapter;
List<ParseObject> ob;
ProgressDialog mProgressDialog;
// ParseQueryAdapter<ParseObject> adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.donar_acceptor_list);
ParseQueryAdapter.QueryFactory<ParseObject> factory =
new ParseQueryAdapter.QueryFactory<ParseObject>() {
public ParseQuery create() {
ParseQuery query = new ParseQuery("Data");
query.orderByDescending("createdAt");
query.whereContains("DonAcc", "donar");
return query;
}
};
ParseQueryAdapter<ParseObject> Adapter = newParseQueryAdapter<ParseObject> (this, factory);
Adapter.setTextKey("username");
final ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(Adapter);
}
}
对于布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>