Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

点击事件问题 #7

Closed
MirrorFlower opened this issue Jun 1, 2017 · 2 comments
Closed

点击事件问题 #7

MirrorFlower opened this issue Jun 1, 2017 · 2 comments

Comments

@MirrorFlower
Copy link

最子项列表中的每个项的点击事件怎么响应啊?在bindView里也监听不到,没有position参数,没法确定点的是哪个子项
public class ThirdLevelNodeViewBinder extends CheckableNodeViewBinder {
TextView textView;

public ThirdLevelNodeViewBinder(View itemView) {
    super(itemView);
    textView = (TextView) itemView.findViewById(R.id.node_name_view);
}

@Override
public int getCheckableViewId() {
    return R.id.checkBox;
}

@Override
public int getLayoutId() {
    return R.layout.item_third_level;
}

@Override
public void bindView(final TreeNode treeNode) {
    textView.setText(treeNode.getValue().toString());
    Log.e("---ThreeTextView", treeNode.getValue().toString());
    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //当点开二级列表的时候,三级列表有几个子项,此方法就会执行几遍
           Log.e("---ThreeTextView", treeNode.getValue().toString());
        }
    });
}

}

@shineM
Copy link
Owner

shineM commented Jun 1, 2017

你都拿到treeNode对象了还要position干嘛 我亲自试了加点击事件没问题,对于你代码中的Log执行多遍是因为你上面那句Log,点击事件的Log不可能全部响应的 有问题继续跟在后面 别开新issue讨论吧 - -

@shineM shineM closed this as completed Jun 1, 2017
@MirrorFlower
Copy link
Author

奥奥 谢谢 我说呢 给力

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants