如何在选项卡式活动(ViewPager)中隐藏白线(附图片)?

时间:2017-08-10 11:28:36

标签: android android-activity android-tabbed-activity

我正试图在我的标签式活动中隐藏actionBar,我几乎已经这样做了,但屏幕上还留有白线(屏幕顶部)。如何隐藏它?

enter image description here

我的活动代码:

 @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();

    }

在Manifest中我设置:

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

0 个答案:

没有答案