对话框活动中的透明导航栏和状态栏

时间:2016-03-11 21:01:02

标签: java android xml layout

我想要对话框活动的透明导航栏和状态栏,我的风格是这样的代码:

   <style name="AppTheme.Dialog" parent="Theme.AppCompat.Dialog">
    <item name="colorAccent">@color/gray</item>
    <item name="windowNoTitle">true</item>
</style>

,这在java中:

public class FilterActivity extends AppCompatActivity {
FloatingActionButton fab;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    setContentView(R.layout.filter_activity);
    getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    fab = (FloatingActionButton) findViewById(R.id.fab_filter_close);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

}
}

enter image description here

我的对话框活动是全屏的,背景是透明的,但导航栏和状态栏是黑色的。我该怎么办?

0 个答案:

没有答案