【发布时间】:2025-11-28 05:55:01
【问题描述】:
我的大多数图像按钮都有相同的涟漪效果,并且大多数按钮在按下时看起来像一个圆圈,但在某些按钮上它看起来像一个椭圆形,我只是不确定为什么它看起来不同。我意识到实际的波纹形状设置为椭圆形,但为什么它在其他一些按钮上看起来像一个圆圈。可能是因为它发生得如此之快,所以我只是看不正确。
这是我的波纹 xml:
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="?android:colorPrimary" />
</shape>
</item>
</ripple>
谢谢。
编辑:在ImageButtons 内的LinearLayout 上使用layout_weight 对我来说是个问题。我从各个按钮中删除了权重,而是在每个按钮之间添加了权重为 1 的空格,如下所示:
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
【问题讨论】:
标签: android android-5.0-lollipop material-design rippledrawable