Bug : Theme.Translucent & FLAG_ACTIVITY_REORDER_TO_FRONT

前端 未结 2 1373
醉梦人生
醉梦人生 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);
    
        }
    
    0 讨论(0)
  • 2021-02-12 17:41

    As a workaround not an answer

    I have done this:

    public class OverlayActivity extends Activity {
    
       @Override
       protected void onNewIntent(Intent intent) {
           super.onNewIntent(intent);
           // Restart self when attempting to be brought to front
           Intent restartIntent = new Intent(this, OverlayActivity.class);
           startActivity(restartIntent);
           finish();
       }
    
       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_overlay);
       }
     }
    

    if anyone can give me an answer they win the brucey bonus!

    0 讨论(0)
提交回复
热议问题