내 activity_main에 appbar를 설정하고 싶습니다. 웬일인지, 나는 그것을 올바르게 설정할 수 없다. 리사이클 러 뷰 아래에 설정됩니다. 여기 아래의 Recyclerview 설정하기
내 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>
감사합니다! 효과가 있습니다. 내 구현이 작동하지 않는 이유는 무엇입니까? –
LinearLayout을 사용해야하는 레이아웃을 수직 또는 수평으로 배치하거나, RelativeLayout 설정 layout_below 등을 사용할 수 있습니다. 귀하의 경우, LinearLayout이 AppBarLayout 및 DrawerLayout에 대해 작동하지 않을 수도 있습니다. 대답을 수락 해주십시오, 고마워요! – MarcGV
의미가 있습니다. 나는 기본적인 것들을 잊어 버렸을 것이다. 내 잘못이야! –