WEB开发网
开发学院手机开发Android 开发 android listView 中存在editView chetxBox等点击... 阅读

android listView 中存在editView chetxBox等点击事件处理

 2010-05-24 16:32:00 来源:WEB开发网   
核心提示:* a TextView and an ImageView.* @author poss3x*/public class ClickableListItemActivity extends ListActivity {/*** Our data class. This data will be bound to* My

* a TextView and an ImageView.

* @author poss3x

*/

public class ClickableListItemActivity extends ListActivity {

/**

* Our data class. This data will be bound to

* MyViewHolder, which in turn is used for the

* ListView.

*/

static class MyData {

public MyData(String t, boolean e) {

text = t;

enable = e;

}

String text;

boolean enable;

}

/**

* Our very own holder referencing the view elements

* of our ListView layout

*/

static class MyViewHolder extends ViewHolder {

public MyViewHolder(TextView t, ImageView i) {

text = t;

icon = i;

}

TextView text;

ImageView icon;

}

/**

* The implementation of ClickableListAdapter

*/

private class MyClickableListAdapter extends ClickableListAdapter {

public MyClickableListAdapter(Context context, int viewid,

List objects) {

super(context, viewid, objects);

// nothing to do

}

protected void bindHolder(ViewHolder h) {

// Binding the holder keeps our data up to date.

// In contrast to createHolder this method is called for all items

// So, be aware when doing a lot of heavy stuff here.

// we simply transfer our object’s data to the list item representatives

MyViewHolder mvh = (MyViewHolder) h;

MyData mo = (MyData)mvh.data;

mvh.icon.setImageBitmap(

mo.enable ? ClickableListItemActivity.this.mIconEnabled

: ClickableListItemActivity.this.mIconDisabled);

mvh.text.setText(mo.text);

}

@Override

protected ViewHolder createHolder(View v) {

上一页  1 2 3 4 5 6 7  下一页

Tags:android listView 存在

编辑录入:coldstar [复制链接] [打 印]
赞助商链接