<分区>
随着 AppCompat v23.4.0 的新更新,我考虑了 2 种 Button 样式:
Widget.AppCompat.Button.Colored
Widget.AppCompat.Button.Borderless.Colored
它们看起来像这样:
也有涟漪效应。但我想创建一个看起来像 Play Store 应用程序的 UNINSTALL 按钮的幽灵按钮,具有这样的涟漪效应:
我该怎么做?
<分区>
随着 AppCompat v23.4.0 的新更新,我考虑了 2 种 Button 样式:
Widget.AppCompat.Button.Colored
Widget.AppCompat.Button.Borderless.Colored
它们看起来像这样:
也有涟漪效应。但我想创建一个看起来像 Play Store 应用程序的 UNINSTALL 按钮的幽灵按钮,具有这样的涟漪效应:
我该怎么做?
最佳答案
将此代码用于背景 xml:
rounded_corner_background.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="2dp"/>
<stroke
android:width="1dp"
android:color="#7FAE56"/>
<solid android:color="@android:color/transparent"/>
</shape>
并将其设置为按钮背景
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_background"/>
对于波纹效果,有很多可用的库.. 这是一个例子 https://github.com/traex/RippleEffect
关于android - 如何创建Android Material Ghost按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37404718/
相关文章:
android - dexedLibs 和 libs 有什么区别?
android - 在 Lollipop 之前的设备上使用 CardView 的空白区域
android - 如何在 TextInputLayout 的密码切换按钮上禁用涟漪效应
java - 为自定义 seekBar 动态更改 LinearGradient 颜色比例
angularjs - 如何使 <img> 和 <md-card> 在 Angular Material 中具有响应性?
Android LocationListener 没有命中 onLocationChanged
android - 静态访问 Android 应用程序的资源?
Android L - Activity with Fragment 显示错误(只显示 fragment )
java - 解析数据时出错 org.json.JSONException : type java. lang.String 无法转换为 JSONObject