我的問題是,AppBarLayout和工具欄一起出現在屏幕頂部,從而阻止了包含內容的視圖。它可以在圖像中看到。我相信我只是在這裏錯過了一些東西。AppBarLayout不在屏幕的頂部
而且,這裏是XML代碼
<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>
<include layout="@layout/content_search" />
編輯:我的主題設置爲NoActionBar
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
它看起來像這樣:
如果您已將**樣式**設置爲** NoActionBar **,則您不應該在預覽窗口頂部顯示的默認工具欄,因爲預覽假定默認工具欄是實際工具欄應用。它將不會出現在已部署的應用程序中 –
@AbhisekLamsal默認工具欄不會顯示在已部署的應用程序中,您是對的,但問題是自定義工具欄會阻止包含內容的視圖。 –
嘗試設置''android:fitSystemWindows'' –