代码之家  ›  专栏  ›  技术社区  ›  Cyrus the Great

创建曲线布局以使用底部图纸android

  •  1
  • Cyrus the Great  · 技术社区  · 7 年前

    我在应用程序中使用了bottomsheet。我想创建类似以下图像的工作表:

    enter image description here

    如何创建曲线布局?我想当点击绿色圆圈时,底部的纸张打开。

    我创建了此形状:

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
            <shape xmlns:android="http://schemas.android.com/apk/res/android"
                android:shape="oval">
                <solid android:color="#4f5551" />
                <size
                    android:width="100dp"
                    android:height="50dp" />
    
            </shape>
        </item>
        <item
            android:bottom="-100dp"
            android:left="-2000dp"
            android:right="-1300dp"
            android:top="48dp">
            <shape xmlns:android="http://schemas.android.com/apk/res/android">
                <solid android:color="#4f5551" />
                <size
                    android:width="100dp"
                    android:height="500dp" />
            </shape>
        </item>
    </layer-list>
    

    看起来根本不像:-(

    *************************编辑**************

    谷歌搜索后,我发现了这个 link :而不是 BottomNavigationView 我扩展了 RelativeLayout 这是我的布局:

    <com.example.saidi.custombottobar.view.ButtomSheetCustom
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginTop="200dp"
            android:background="@color/colorAccent"
            tools:context=".view.MainActivity">
    

    enter image description here

    如何将这些曲线旋转到布局顶部而不是内部曲线?

    0 回复  |  直到 7 年前