gpt4 book ai didi

Android 移除抽屉导航上的阴影

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:17:00 25 4
gpt4 key购买 nike

See here what i mean

您好,我正在使用库存抽屉导航 v4,我想问一下如何在抽屉导航打开时删除背景阴影。

这是我的NavigationDrawerFragment.java代码

public void setUp(int fragmentId, DrawerLayout drawerLayout) {
mFragmentContainerView = getActivity().findViewById(fragmentId);
mDrawerLayout = drawerLayout;

// set a custom shadow that overlays the main content when the drawer opens
mDrawerLayout.setDrawerShadow(R.drawable.trasparent, GravityCompat.START);
// set up the drawer's list view with items and click listener

ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);

这是 MainActivity.xml

<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Main layout -->
<FrameLayout
android:id="@+id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />


<ImageView
android:id="@+id/ImageView3_Left"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="#FFFFFFFF"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"/>

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

最佳答案

我找到了解决方案 :D

mDrawerLayout.setScrimColor(getResources().getColor(android.R.color.transparent));

在 MainActivity.java 中添加这个

关于Android 移除抽屉导航上的阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31568530/

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