当然是选中的时候为true,不选中的时候为false

解决方案 »

  1.   

    这个楼主试试就明白了。严格来说,setChecked函数被调用的时候,函数就会被用到,checked参数由调用者确定。通常来说,以CheckBox为例,默认情况下,用户点击CheckBox的时候,setChecked函数就会被调用到,checkable的值与当前isChecked()的返回值相反。
      

  2.   

    我这里有个应用,一个自定义的ListItem实现的Checkable,,什么情况下是选中呢,点击一次是选中吗。。我试了是false啊
      

  3.   

    你可以在onclick事件中处理,setChecked(true/false);
      

  4.   

    我这里有个应用是自定义的listitem实现的Checkable。。没有人调用setChecked。单击的时候,(boolean checked) 是false。。另外listview设置了setMultiChoiceModeListener (new   ListView.MultiChoiceModeListener)。。长按的时候(boolean checked) 是true...
    public void setChecked(boolean checked) 这个方法我找了没人调用过。。所以我疑惑这个参数到底是根据什么得到的值。。
      

  5.   

    你可以在onclick事件中处理,setChecked(true/false);我想过,可是setChecked(boolean checked)这个方法比onclick先执行啊。。在我传参数过去之前,,他已经执行一遍了
      

  6.   

    肯定是选中的时候为true,没有选中的时候为false了。
      

  7.   

    看看这个就明白了 AbsListView.java    updateOnScreenCheckedViews()1124    private void updateOnScreenCheckedViews() {
    1125        final int firstPos = mFirstPosition;
    1126        final int count = getChildCount();
    1127        final boolean useActivated = getContext().getApplicationInfo().targetSdkVersion
    1128                >= android.os.Build.VERSION_CODES.HONEYCOMB;
    1129        for (int i = 0; i < count; i++) {
    1130            final View child = getChildAt(i);
    1131            final int position = firstPos + i;
    1132
    1133            if (child instanceof Checkable) {
    1134                ((Checkable) child).setChecked(mCheckStates.get(position));
    1135            } else if (useActivated) {
    1136                child.setActivated(mCheckStates.get(position));
    1137            }
    1138        }
    1139    }