gpt4 book ai didi

Android - 向上滑动面板(库)圆角

转载 作者:太空宇宙 更新时间:2023-11-03 12:27:14 24 4
gpt4 key购买 nike

我正在开发应该使用抽屉导航作为菜单的应用程序,为了更好的用户体验,我决定用向上滑动面板替换抽屉导航。


我的 View 在这张图片中


enter image description here


现在我想制作这个带有圆角的菜单我使用了带有 cornerRadius 属性的 CardView 但没有正常工作。


这是我的向上滑动面板的 xml 代码

   <com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="0dp"
sothree:umanoShadowHeight="0dp"
android:id="@+id/SlidingUpPanel">


</com.sothree.slidinguppanel.SlidingUpPanelLayout>

在 Facebook Messenger 应用程序中可以看到相同的设计:


enter image description here


欢迎任何想法,提前致谢...

PS:我使用的图书馆链接:Github library

那些想要所有布局的人:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />


<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/SlidingUpPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="0dp"
sothree:umanoShadowHeight="0dp">

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#345D7D" />


<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"
android:orientation="horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33333">

<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitXY"
android:src="@drawable/quran_icon" />

</RelativeLayout>


<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33333">

<ImageButton
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_centerInParent="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitXY"
android:src="@drawable/qibla_compass_icon" />

</RelativeLayout>


<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33333">

<ImageButton
android:id="@+id/findMyLocation"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitXY"
android:src="@drawable/location_icon" />


</RelativeLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"
android:orientation="horizontal">


<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33333">

<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true" />

</RelativeLayout>


<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33333">

<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true" />

</RelativeLayout>


<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33333">

<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true" />

</RelativeLayout>
</LinearLayout>


</LinearLayout>


</com.sothree.slidinguppanel.SlidingUpPanelLayout>


</LinearLayout>

最佳答案

上滑面板需要属性:

sothree:umanoOverlay="true"

为了叠加布局。


通过这个属性,我们不仅可以使面板圆角(使用CardView),还可以将透明背景设置为slideuppanel。

引用:Github transparent background (Issues)

关于Android - 向上滑动面板(库)圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46657702/

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