Remove the white screen a Slide window transition creates when it starts

后端 未结 4 2054
执笔经年
执笔经年 2020-12-31 05:27

I am using an activity with a black background. That same activity has a toolbar and a DrawerLayout as well. This white screen makes the look inconsistent.

It can be

4条回答
  •  误落风尘
    2020-12-31 05:57

    Seems like the old activity will not "stay" in view when you have a custom transition. I don't know when that started, but you definitely didn't need a stay animation in some previous API levels. The old 2.0 era overridePendingTransition still works fine:

    anim/slide_in.xml

    
    
        
    
    

    anim/slide_out.xml

    
    
        
    
    

    anim/stay.xml

    
    
        
    
    

    Main activity's startActivity:

    startActivity(intent);
    overridePendingTransition(
            R.anim.slide_in,
            R.anim.stay
    );
    

    Second activity's return:

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    
        overridePendingTransition(
                0,
                R.anim.slide_out
        );
    }
    

提交回复
热议问题