问题描述
我目前正在学习android,想要创建一个具有提升效果的按钮。 更精确地说,我想要像下面的图片一样的高程效果。
有人可以帮助我如何在android studio中制作此类按钮吗?
解决方法
在可绘制文件夹中添加XML文件并将其命名为a.xml:
public Specification<Plan> hasSort(String sortBy) {
return (root,query,criteriaBuilder) -> {
return //count of by Plan in Subscribers
}
}
添加您的按钮:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Gray shadow. -->
<item android:left="3dp" android:top="5dp">
<shape>
<solid android:color="@android:color/darker_gray" />
<corners android:radius="15dp" />
</shape>
</item>
<!-- White foreground. -->
<item android:bottom="5dp" android:right="3dp">
<shape>
<solid android:color="@android:color/white" />
<corners android:radius="15dp" />
</shape>
</item>
</layer-list>
输出:
,
您只需要在xml中的Button标记下添加以下行。它将根据需要添加高程。
android:stateListAnimator="@null"