Why doesn't setVisibility work after a view is animated?

后端 未结 6 1755
别跟我提以往
别跟我提以往 2020-12-04 20:56

Why doesn\'t the textView become invisible?

Here is my layout xml:




        
6条回答
  •  一个人的身影
    2020-12-04 21:26

    Another way to work around this is to wrap your animated view in another view and set the visibility of that wrapper view.

    
    
        
            
        
    
    

    And the code then becomes this:

    TextView tvRotate = (TextView) findViewById(R.id.tvRotate);
    FrameLayout animationContainer = (FrameLayout)findViewById(R.id.animationHoldingFrame)
    
    RotateAnimation r = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    r.setDuration(0);
    r.setFillAfter(true);
    tvRotate.startAnimation(r);
    animationContainer.setVisibility(View.INVISIBLE);
    

提交回复
热议问题