我正在开发一个应用程序,该应用程序应使用导航抽屉作为菜单,但为了获得更好的用户体验,我决定将导航抽屉替换为向上滑动面板。
同样的设计可以在Facebook Messenger应用程序中看到:
我的视图在这张图片中
现在我想要制作带有圆角的菜单,我使用了CardView并设置cornerRadius属性,但它没有正常工作。
这是我的向上滑动面板的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>
任何想法都将受到欢迎,提前致谢...
附注:我使用的库链接: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>
SlidingUpPanelLayout
视图中使用app:umanoShadowHeight="0dp"
和sothree:umanoOverlay="true"
。 - Homayoon Ahmadi