我有MainAcitvity(Singletask)
,SecondActivity
和ForwardActivity
:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);
}
});
}
}
这是SecondActivity
:
public class SecondActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_task_acitvity);
findViewById(R.id.bt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(SecondActivity.this, ForwardActivity.class);
startActivity(intent);
}
});
}
}
这是ForwardActivity
:
public class ForwardActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forward);
Intent intent = new Intent(ForwardActivity.this, MainActivity.class);
startActivity(intent);
}
}
在Android 5.0+上,这会导致黑屏。
如果我使用windowIsTranslucent添加SecondAcitvity,则会出现黑屏问题。
如何在不添加windowIsTranslucent的情况下解决黑屏问题?
谢谢你。