Android ExpandableListView / ExpandableListActivity 使用及数据更新
2010-08-21 06:33:00 来源:WEB开发网>
< Button
android:id="@+id/add_ok"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:text="OK"
/>
< Button
android:id="@+id/add_no"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:text="NO"
/>
< /LinearLayout>
< /LinearLayout>
* add.xml 里 View 的定义:
Xml代码
public void createDialogAdd(){
viewAdd = this.getLayoutInflater().inflate(R.layout.add, null);
dialogAdd = new Dialog(this);
dialogAdd.setContentView(viewAdd);
dialogAdd.setTitle("输入新成员信息");
add_name = (EditText)viewAdd.findViewById(R.id.add_name);
add_phone = (EditText)viewAdd.findViewById(R.id.add_phone);
add_sex = (EditText)viewAdd.findViewById(R.id.add_sex);
add_home = (EditText)viewAdd.findViewById(R.id.add_home);
add_ok = (Button)viewAdd.findViewById(R.id.add_ok);
add_no = (Button)viewAdd.findViewById(R.id.add_no);
add_ok.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
String[] data = {
add_phone.getText().toString(),
add_sex.getText().toString(),
add_home.getText().toString()
};
addInfo(add_name.getText().toString(),data);
dialogAdd.dismiss();
mAdapter.notifyDataSetChanged();
}
});
add_no.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
dialogAdd.dismiss();
}
});
}
public void createDialogAdd(){
viewAdd = this.getLayoutInflater().inflate(R.layout.add, null);
Tags:Android ExpandableListView ExpandableListActivity
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接