gpt4 book ai didi

android - 为已经自定义的按钮添加涟漪效果

转载 作者:太空狗 更新时间:2023-10-29 15:59:17 26 4
gpt4 key购买 nike

我正在尝试为自定义按钮添加涟漪效果。但我找到的唯一解决方案是添加背景,我已经为该按钮实现了圆角。现在我想添加涟漪效应。这是我的按钮标签到目前为止的样子:

<Button
android:text="PLAY"
android:id="@+id/button"
android:textSize="20dp"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/roundedbutton"
android:onClick="gotomainpage"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="200dp" />

最佳答案

在您的按钮中使用此代码

android:foreground="?attr/selectableItemBackground"

关于android - 为已经自定义的按钮添加涟漪效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42819981/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com