私のactivity_mainにappbarを設定したいと思います。何らかの理由で、正しく設定できません。リサイクラービューの下に設定されています。RecyclerviewをAppbarの下に設定する
ここにここに私のactivity_main
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation = "vertical"
android:layout_marginTop="?attr/actionBarSize"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_heritage_sites"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"/>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
は私app_bar_mainです
<?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"
tools:context=".MainActivity">
<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="@color/colorWhite"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
あなたの時間と時間をありがとうエル・P!
感謝を!それは働いている。私の実装はなぜ機能していませんでしたか? –
レイアウトのために、LinearLayoutを使用する必要があるビューを垂直または水平に配置するか、またはRelativeLayout設定のlayout_belowなどを使用することができました。あなたのケースでは、LinearLayoutがAppBarLayoutおよびDrawerLayoutに対して機能しない可能性があります。答えを受け入れてください、ありがとう! – MarcGV
意味があります。私は基本的なものを忘れていたに違いない。私の悪い! –