我已经完成了一个tabbedView,它在一个片段中保存了一个ListView,我使用了一个ActionToolbar,我已经禁用了滑动
现在我看到我的ListView被一个空白空间所覆盖,我甚至不知道如何命名
如何删除它?
XML
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
>
<android.support.v7.widget.Toolbar
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
android:background="@color/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/custom_tab_layout_height"
app:tabIndicatorHeight="4dp"
app:tabIndicatorColor="@color/slider_tab"
app:tabMode="fixed"
app:tabGravity="fill"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:layout_marginBottom="?attr/actionBarSize"
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
包含我的片段的活动的OnCreateMethod
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SliceAppDB.init();
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("SliceApp",null, getResources().getColor(R.color.colorPrimary));
((Activity)this).setTaskDescription(taskDescription);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitleTextColor(getResources().getColor(R.color.slider_tab));
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
params.setScrollFlags(0);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
vpPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(vpPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(vpPager);
setupTabIcons();
TabLayout.Tab tab= tabLayout.getTabAt(1);
tab.select();
}