Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work

前端 未结 11 2129
[愿得一人]
[愿得一人] 2020-12-02 12:51

I want my DatePicker and the button to be invisible in the begining. And when I press my magic button I want to setVisibility(View.Visible);

The problem

11条回答
  •  死守一世寂寞
    2020-12-02 13:42

    In my case I found that simply clearing the animation on the view before setting the visibility to GONE works.

    dp2.clearAnimation();
    dp2.setVisibility(View.GONE);
    

    I had a similar issue where I toggle between two views, one of which must always start off as GONE - But when I displayed the views again, it was displaying over the first view even if setVisibility(GONE) was called. Clearing the animation before setting the view to GONE worked.

提交回复
热议问题