所以我有一段时间没有更新这个项目,发现在预览布局时我的所有xml视图似乎都显示了双标题栏。
以下是代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
tools:context=".MainActivity">
<include layout="@layout/toolbar" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawerLayout_register"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false">
<RelativeLayout> Content here </RelativeLayout>
<RelativeLayout
android:id="@+id/drawer_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="#fff">
<ListView
android:id="@+id/left_drawer_register"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:divider="#eee"
android:dividerHeight="1dp" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
有什么想法?这会导致我的布局关闭吗?因为看起来“居中”现在根本不把事情放在中心位置。
这是toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/toolbar_red"
android:minHeight="?attr/actionBarSize"
android:showAsAction="never"
android:textColor="#ffffff"
android:theme="@style/myAppTheme">
</android.support.v7.widget.Toolbar>