我正在將Material Design應用到具有導航抽屜的我的應用中。在Nav的所有不同實現中。帶材料設計的抽屜和工具欄(see this post);我已選擇讓應用程序保持與ICS/Halo設計類似的效果,並讓Nav Drawer在工具欄下滑出。問題是當導航抽屜打開時,工具欄會像陰影一樣變暗。我將如何防止工具欄變黑?如果您在上面鏈接的帖子中看到圖片,我在#6,3或5之後,但現在我的外觀更像#9。導航抽屜打開時從工具欄中刪除陰影 - 材質設計支持庫
例(從上面後):
後(工具欄上沒有影子)我是什麼:
我目前得到(NAV當抽屜打開工具欄變暗):
這裏是我的主要活動的XML代碼:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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:context="com.funkhaus.navdrawer.app.MainActivity">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- We use a Toolbar so that our drawer can be displayed
in front of the action bar; Added for Material Design -->
<android.support.v7.widget.Toolbar
android:id="@+id/my_awesome_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize" />
</FrameLayout>
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:fitsSystemWindows="true"
android:layout_gravity="start"
android:name="com.funkhaus.brewwerks.NavigationDrawerFragment" />
的顯着的部分之處在於,其ID是'container'
的<FrameLayout>
是我的所有片段被膨脹,並且其marginTop
設定爲工具欄的高度因此它的內容將是工具欄的下方。同樣,導航抽屜片段也將其marginTop
設置爲工具欄的高度,以便在其下滑動。
將工具欄放在DrawerLayout之外。 – alanv 2014-10-31 06:01:15
根據我的理解,當使用導航抽屜時,''需要成爲根視圖 –
Flash
2014-10-31 14:18:10
您的內容的根,是的。不是您的工具欄的根。 – alanv 2014-10-31 14:44:16