gpt4 book ai didi

android - 热门为android中的NavigationDrawerFragment设置背景色

转载 作者:行者123 更新时间:2023-11-30 02:40:38 25 4
gpt4 key购买 nike

我想知道如何在 android 中为 NavigationDrawerFragment 设置背景颜色。有元素的代码。

PS:我已经设置了属性 android:background 但它不起作用。

<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:background="@color/connexion_button"
tools:context="com.example.user.unchained.HomesActivity">

<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
If you're not building against API 17 or higher, use
android:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/connexion_button"
android:name="com.example.user.unchained.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>

最佳答案

fragment_navigation_drawer.xml

   <LinearLayout 
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/connexion_button"


>



</LinerLayout >

关于android - 热门为android中的NavigationDrawerFragment设置背景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25806741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com