我一直有一個相當難的問題,弄清楚如何擺脫操作欄頂部的黑線。鏈接中有一張圖片顯示黑線的位置。我想知道是否有辦法擺脫它。這看起來像是一個非常簡單的問題,但我無法在網上找到關於如何擺脫它的任何內容。刪除操作欄頂部的深色
任何幫助表示讚賞
這裏是我的XML佈局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay"
android:layout_alignParentTop="true"
style="@style/Base.Theme.AppCompat.Light">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="false" />
</android.support.design.widget.AppBarLayout>
</RelativeLayout>
我得到一個錯誤java.lang.IllegalStateException:這個Activity已經有一個窗口裝飾提供的操作欄。請勿在您的主題中請求Window.FEATURE_SUPPORT_ACTION_BAR並將windowActionBar設置爲false以使用工具欄。我檢查了我設置windowActionBar爲false,所以我不知道是什麼造成它 – thequantumgamer01
請確保你沒有設置'android:windowActionBar'。它不同於'windowActionBar'(沒有'android:'前綴 - 它在兼容庫中,而不是Android系統)。 – drmercer
如果這不起作用,請將該活動的主題擴展爲'Theme.AppCompat.NoActionBar'或'Theme.AppCompat.Light.NoActionBar'。 – drmercer