我使用Android导航抽屉,我有两个屏幕,我复制粘贴导航和更改栏,仅限内容页面,但是对于Page 1一切都很好,而第2页(以红色突出显示)显得额外。< / p>
请帮助
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.ntu.mobile.proj.docsearch.DocSearchActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/doc_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_docsearch" />
</android.support.design.widget.CoordinatorLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doc_search);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
spinner = (Spinner) findViewById(R.id.doc_spinner);
Bundle extras = getIntent().getExtras();
userName = extras.getString("userName");
userId = extras.getInt("userId");
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.specialist_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_doc_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_doc_view);
navigationView.setNavigationItemSelectedListener(this);
View header = navigationView.getHeaderView(0);
userNameTxt = (TextView) header.findViewById(R.id.profile_name);
userNameTxt.setText(userName);
txt_search_docname = (TextView) findViewById(R.id.txt_search_docname);
txt_search_pincode = (TextView) findViewById(R.id.txt_search_pincode);
}
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>