2017-04-08 182 views
0

我想創建導航抽屜與透明的工具欄,但我endup與工具欄上的陰影像這樣 enter image description here抽屜式導航欄透明

我怎樣才能去除陰影?

我儘量擡高,但它刪除所有工具欄全部,

<android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:id="@+id/mAppBarLayout" 
     android:fitsSystemWindows="false" 
     android:layout_height="wrap_content"> 

      <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.ActionBar.Transparent" /> 
    </android.support.design.widget.AppBarLayout> 

有人介意幫我?

+0

嘗試使用'應用:elevation',而不是'機器人:elevation'並將其設置爲'0dp' –

+0

在appbarlayout或工具欄裏面? –

+0

在AppBarLayout中。但是有一些已知的問題,它不適用於SDK 21及更高版本。您可以找到許多解決方案,從設置XML中的高度或編程方式。 –

回答

1

試着在你的活動onCreate()下面的代碼:

if(getSupportActionBar() != null) 
{ 
    getSupportActionBar().setElevation(0); 
} 

希望這有助於