安卓布局 ripple
时间: 2023-07-09 20:54:17 浏览: 159
如果你是想问如何在安卓应用程序中使用Ripple效果的布局,可以使用以下布局代码:
```xml
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button with Ripple Effect"
android:background="?attr/selectableItemBackgroundBorderless"/>
```
在上面的布局代码中,我们将`Button`的背景设置为`?attr/selectableItemBackgroundBorderless`,这将会让按钮拥有一个带有Ripple效果的背景。你也可以使用其他支持Ripple效果的属性,例如`?attr/selectableItemBackground`,它会在按钮被点击时显示一个Ripple效果,但是没有边框效果。需要注意的是,这些属性只在API级别21及以上的设备上才能生效。
阅读全文
相关推荐


















