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

全局悬浮窗中放置的checkbox无法绑定事件,点击checkbox也触发不了绑定事件 #249

Open
JimssM opened this issue Jun 16, 2024 · 0 comments

Comments

@JimssM
Copy link

JimssM commented Jun 16, 2024

    CheckBox checkBox;
    LayoutInflater  inflater;
    View floatView;
    inflater  = getLayoutInflater();
    floatView = inflater.inflate(R.layout.float_window, null);
    Log.d(TAG, "initView: "+floatView.findViewById(R.id.checkBox));
    checkBox = floatView.findViewById(R.id.checkBox);

    if (checkBox != null) {
        // 如果 checkBox 不为空,表示成功找到了对应 ID 的 CheckBox
        Log.d(TAG, "CheckBox found with ID: " + checkBox.getId());
    } else {
        // 如果 checkBox 为空,表示找不到对应 ID 的 CheckBox
        Log.e(TAG, "CheckBox not found with ID: R.id.checkBox");
    }
    checkBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, "initView: "+R.id.checkBox);
            Log.d(TAG, "onClick: ");
        }
    });
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

1 participant