更新时间:2022-12-30 21:53:04
您需要使用这里.
我开发了View
来绘制类似Google pay的形状,该形状继承自FrameLayout
.源代码可在其github存储库中使用(但尚未记录!).但是,将以下几行添加到您的应用级build.gradle
文件中:
I have developed a View
to draw a shape like google pay which inherits from FrameLayout
. The source code is available on its github repository (but not documented yet!). However, add the following lines to your app level build.gradle
file:
repositories {
jcenter()
}
dependencies {
implementation 'com.aminography:beziercurvebulgelayout:1.0.2'
}
然后您可以在xml
布局文件中使用它,如下所示:
Then you can use it in xml
layout files as following:
<com.aminography.view.BezierCurveBulgeLayout
android:id="@+id/bulgeLayout"
android:layout_width="match_parent"
android:layout_height="56dp"
app:bulgeType="bulge"
app:bulgeColor="@color/colorPrimary"
app:curveWidth="32dp"
app:flatWidth="56dp"
app:flatHeight="24dp">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@android:drawable/ic_menu_compass"/>
</com.aminography.view.BezierCurveBulgeLayout>
通过更改以下属性,可自定义形状和颜色以实现目标形状:
Its shape and color is customizable to achieve the target shape by changing below attributes: