Bug : Theme.Translucent & FLAG_ACTIVITY_REORDER_TO_FRONT

前端 未结 2 1370
醉梦人生
醉梦人生 2021-02-12 16:46

I have an activity with the translucent Theme :

android:theme=\"@android:style/Theme.Translucent.NoTitleBar\"

Also the problem is reproduceable

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-12 17:22

    If we do not set the theme from AndroidManifest.xml, activity block and set the theme before setContentView, in onCreate method in the first translucent activity, the problem is solved, below is the code:

    public class TranslucentActivityDemoActivity extends Activity {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
          this.setTheme(R.style.myTheme);
    
            setContentView(R.layout.main);
    
        }
    

提交回复
热议问题