我正在關(guān)注本教程我被困在我試圖將按鈕添加到應(yīng)用程序欄的地方。當(dāng)我向右滑動(dòng)時(shí),會(huì)出現(xiàn)導(dǎo)航抽屜,因此可以正常工作。它只是我遇到問(wèn)題的欄中的按鈕,當(dāng)我將其添加v7.widget.Toolbar到 FrameLayout 下的 XML 時(shí),它會(huì)破壞布局。最初在我的 XML 中,我只有一個(gè)約束布局,一個(gè) Scrollview 作為一個(gè)孩子,里面有一個(gè) LinearView(垂直)。但是我無(wú)法理解為什么這不起作用:<?xml version="1.0" encoding="utf-8"?><!-- Use DrawerLayout as root container for activity --><android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- Container for contents of drawer - use NavigationView to make configuration easier --> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" app:menu="@menu/drawer_view" app:headerLayout="@layout/nav_header" /> <!-- Layout to contain contents of main body of screen (drawer will slide over this) --> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.ActionBar" /> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent">當(dāng)我運(yùn)行它時(shí),頂部欄似乎超過(guò)了整個(gè)窗口并且顏色消失并且按鈕不可點(diǎn)擊,因?yàn)長(zhǎng)inearLayout它位于它的頂部。我哪里錯(cuò)了?
添加回答
舉報(bào)
0/150
提交
取消