小编Anj*_*ali的帖子

在为特定视图使用Contextual Action Bar时无法解析方法startActionMode()

我一直试图在checkBox上使用Contextual Action Bar单击以从listView中删除多行... listview在每行中都有一个复选框和一个textview.在适配器类中,我调用startActionMode(),如下所示:

**@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        View view=convertView;
        Log.v("ConvertView", String.valueOf(position));
        final ToPayModel state = toPayList.get(position);
        if (convertView == null)
        {
            inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.to_pay_item, null);
            holder = new ViewHolder();
            holder.name = (TextView) convertView.findViewById(R.id.tvToPay);
            holder.check = (CheckBox) convertView.findViewById(R.id.toPaycheck);
            convertView.setTag(holder);
            //holder.name.setOnCheckedChangeListener();
        }
        else
        {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.check.setOnClickListener( new View.OnClickListener()
        {
            public void onClick(View v)
            {
                CheckBox cb = (CheckBox) v;
                ToPayModel toPayModel = (ToPayModel) cb.getTag();
                Toast.makeText(context, "Clicked …
Run Code Online (Sandbox Code Playgroud)

android listview contextual-action-bar actionmode

1
推荐指数
1
解决办法
4391
查看次数