android: layout_width = "fill_parent"
android: layout_height = "fill_parent">
android: layout_width = "wrap_content"
android: layout_height = "wrap_content">
android: layout_height = "wrap_content"
android: textColor = "# FFFFFFFF"
android: textSize = "22px" />
android: layout_height = "wrap_content"
android: textColor = "# D1D1D1"
android: textSize = "13px" />
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_weight = "1">
android: id = "@ + id / check"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
>
He then bound to the data inside listview above is my SimpleAdapter dynamically generated, but the question now is how do I get where I want to monitor him all checkbox directly findviewbyid (r.id.check) is always abnormal and each line explosion empty checkbox impossible data is a name of it how to solve this problem ah thank you
Reply:
Dynamic settings checkbox of id, id will be able to remember
Reply:
Please elaborate on what you can not understand what my layout inside this control, I have to set it to her.
Reply:
Yes, you can re-set the id such as setId (0x0020); such provisions themselves, and then go get based on id
Reply:
Listview event
rewrite the getview, before returning value plus a handlinghttp://blog.csdn.net/zhangxing555/article/details/8793099
@ Override
public View getView (int position, View convertView, ViewGroup parent) {
convertView = mInflater.inflate (layoutID, null);
for (int i = 0; iif (convertView.findViewById (ItemIDs [i]) instanceof ImageView) {
ImageView iv = (ImageView) convertView.findViewById (ItemIDs [i]);
iv.setBackgroundResource ((Integer) list.get (position). get (
flag [i]));
} Else if (convertView.findViewById (ItemIDs [i]) instanceof TextView) {
TextView tv = (TextView) convertView.findViewById (ItemIDs [i]);
tv.setText ((String) list.get (position) get (flag [i]).);
} Else {
/ / ... Note 2
}
}
addListener (convertView);
return convertView;
}
/ **
* Children's shoes just to listen for the event need to set up assembly to write the following in this method can be friends!
* Else need to change!
* Note 3
* /
public void addListener (View convertView) {
((Button) convertView.findViewById (R.id.btn)). SetOnClickListener (
new View.OnClickListener () {
@ Override
public void onClick (View v) {
new AlertDialog.Builder (MainActivity.ma)
. SetTitle ("Custom Universal SimpleAdapter")
. SetMessage ("button to trigger the listener successful event!")
. Show ();
}
});
((CheckBox) convertView.findViewById (R.id.cb)).
setOnCheckedChangeListener (new OnCheckedChangeListener () {
@ Override
public void onCheckedChanged (CompoundButton buttonView, boolean isChecked) {
new AlertDialog.Builder (MainActivity.ma)
. SetTitle ("Custom Universal SimpleAdapter")
. SetMessage ("CheckBox success triggered the state change event listener!")
. Show ();
}
});
}
Reply:
What name did not feel it necessary to take
Reply:
Get the name? What name is
No comments:
Post a Comment