使BottomSheet的某些部分变得透明

问题描述 投票:0回答:1

我想透明底部的一些部分透明。我的目标是实现这一点。(箭头指向)enter image description here但现在我的应用程序看起来像那样。 enter image description here如何实现第一个图像外观?

我的代码Bottom_Shee.xml

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     xmlns:tools="http://schemas.android.com/tools"
     android:orientation="vertical"
     android:background="@color/colorPrimaryDark"
     android:padding="4dp">
<TextView
    android:id="@+id/text_view_bottom_sheet_title"
    android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
    android:textColor="@color/colorAccent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"/>
<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recycler_view_set"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:listitem="@layout/set_item"/></LinearLayout>

我的BottomSheetFragment.java类如下所示

    recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayout.HORIZONTAL,false));
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(adapter);
java android xml transparent bottom-sheet
1个回答
0
投票

您必须增加RecyclerView项目的宽度。之后在RecyclerView上添加一个视图。使用xml drawable将添加的视图的背景设置为倾斜形状的边缘背景。将drawable的颜色设置为透明。

© www.soinside.com 2019 - 2024. All rights reserved.