【问题标题】:Ripple Effect Duration in Android XMLAndroid XML 中的涟漪效应持续时间
【发布时间】:2015-09-23 22:51:30
【问题描述】:

我正在学习材料设计。我尝试使用这个 gradle 对按钮产生涟漪效应

dependencies {
compile 'com.github.traex.rippleeffect:library:1.3'
}

来自这个https://github.com/traex/RippleEffect链接

有很多属性不起作用 比如

app:rv_rippleDuration="1200"
app:rv_color="#d3d3d3"

我在按钮上有事件和涟漪效果,但是当我点击按钮时,方法被调用。我想要的是第一个涟漪效应应该完成,然后应该采取行动。

XML 代码

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp">

        <com.andexert.library.RippleView
            android:id="@+id/ripple1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            rv_centered="true"
            app:rv_rippleDuration="1800"
            app:rv_color="#000000">

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/fromDateButton" />

        </com.andexert.library.RippleView>

    </LinearLayout>

用户无法体验动画。

【问题讨论】:

  • 直接在 repo 上打开一个问题。你会得到更好的回应。
  • 不要在 XML 文件中添加,而是尝试在 java 代码中添加持续时间。
  • 知道该怎么做。
  • github.com/traex/RippleEffect/issues/66 在 git hub 上打开问题

标签: android xml android-studio material-design ripple


【解决方案1】:

GitHab 描述页面示例中的问题。 改变

rv_centered="true"

app:rv_centered="true"

一切都会完成。 ReppleView 的所有属性必须包含app:

【讨论】:

  • 不,它不起作用。我想,我应该在每个事件中添加thread,直到涟漪效应完成,然后释放thread
【解决方案2】:

在使用应用程序资源之前,您需要在 RippleView 中将 xmlns:app="http://schemas.android.com/apk/res-auto" 添加为 xmlns

【讨论】:

    猜你喜欢
    • 2018-02-05
    • 2020-05-30
    • 2015-07-03
    • 1970-01-01
    • 2019-12-07
    • 1970-01-01
    • 2017-03-17
    • 2016-04-25
    • 2015-03-23
    相关资源
    最近更新 更多