Issue with RelativeLayout when View visibility is View.GONE

后端 未结 8 878
自闭症患者
自闭症患者 2021-02-02 05:11

I\'ve a RelativeLayout thus:



 // <-- View.VISIBLE OR View.GONE

<         


        
8条回答
  •  太阳男子
    2021-02-02 05:20

    Forget about INVISIBLE or GONE, use this instead:

    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) view.getLayoutParams();
    
    params.height = 0;
    
    params.setMargins(0,0,0,0);
    
    view.setLayoutParams(params);
    

提交回复
热议问题