Constraint遇到的那些坑之Android View设置visible无效的问题

在Android开发中,遇到使用ConstraintLayout时控件的visible属性设置无效的困扰。通过代码展示问题现象,即ACTION1按钮无法隐藏ACTION2。问题根源在于Group控件,所有在Group ids内的控件显示状态会同步。解决方案是将需要独立控制显示隐藏的控件从Group中移出。
摘要由CSDN通过智能技术生成

Constraint遇到的那些坑之Android View设置visible无效的问题

发现问题

近期在开发界面的时候,需要做Android的控件显示隐藏的操作,发现在代码中设置visible属性不生效,再看代码确确实实也执行了。发现问题很诡异,排查了很久终于解决了。
在这里插入图片描述

Talk is cheap.Show me your code.

当当当当~

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <Button
        android:id="@+id/button_1"
        android:layout_width="wrap_content"
        android:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值