简体   繁体   English

通过可见性更改来更新复选框状态

[英]Update check-boxes status with visibility change

I am having check boxes to control the visibility of different views. 我有复选框来控制不同视图的可见性。 When check box status is changed similarly visibility is changed, which is working fine. 当复选框状态更改时,可见性也将更改,这可以正常工作。 In my app views visibility also changes on different user input. 在我的应用程序视图中,可见性也会随着不同的用户输入而改变。 I want to update checkbox status if visibility of view change by any way. 如果视图的可见性以任何方式改变,我想更新复选框状态。 Is there any way to do it. 有没有办法做到这一点。

You have to put 你必须把

checkbox.setChecked(true);

anywhere that you call 您打电话的任何地方

someView.setVisibility(View.INVISIBLE);

There is no way AFAIK that you can inherently "watch" the visibility state, you have to active set the checked state at the same time that you change the visibility state. AFAIK无法固有地“监视”可见性状态,必须在更改可见性状态的同时主动设置检查状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 复选框可实现多屏幕尺寸兼容性 - Check-boxes for multi screen size compatability 动态添加一个按钮和复选框到我的列表视图? - Add a button and check-boxes dynamically to my list view? 如何在Android SDK Manager中选中与API级别相对应的复选框? - How to check the check-boxes corresponding to API levels in Android SDK Manager? 只希望 recyclerview 中的复选框或单选按钮选中一个框 - only want check-boxes or radio buttons in recyclerview to check one box 有没有办法检查状态栏的可见性? - Is there a way to check the visibility of the status bar? Android:与广播组在同一上下文菜单中的项目很少,而复选框则很少 - Android: Having few items in the same context menu as a radio group and few as check-boxes 如何在android中检查EditText的可见性状态? - How to check visibility status of EditText in android? 无法获得复选框的状态作为ListView项的子元素 - Unable to get Status of Check boxes as a child element of ListView Item Android在菜单项上单击更改复选框的可见性 - Android on menu item click change visibility of check box 如何在Ionic 4中检查连接状态而不更改状态? - How to check connection without change status in ionic 4?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM