0

我试图在我的选项卡式活动中隐藏 actionBar,我几乎做到了,但白线(在屏幕顶部)留在屏幕上。如何隐藏它?

在此处输入图像描述

我的活动代码:

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main2);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setCurrentItem(1);

    ActionBar bar = getSupportActionBar();
    if(bar != null) {
        bar.hide();

    }

在清单中我设置:

android:theme="@style/Theme.AppCompat.Light.NoActionBar"
4

0 回答 0