如何设计具有高程效果的按钮

问题描述

我目前正在学习android,想要创建一个具有提升效果的按钮。 更精确地说,我想要像下面的图片一样的高程效果

enter image description here

有人可以帮助我如何在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>

输出:

enter image description hereenter image description here

,

您只需要在xml中的Button标记下添加以下行。它将根据需要添加高程。

android:stateListAnimator="@null"

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...