我创建了一个扩展 View 组的自定义布局,以便实现类似于此视频 1:18 中的滑动菜单:https://www.youtube.com/watch?v=YeR7McJIltk
但是,我不知道如何在菜单滑入时使背景内容变暗。
最佳答案
你可以这样做:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1">
//your views are here
</LinearLayout>
<View
android:id="@+id/dim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cc000000" />
</RelativeLayout>
并使您的dim
FrameLayout
仅在菜单打开时可见,在关闭时不可见
关于java - 如何使自定义布局的背景变暗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38584883/