Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在工具栏中实现涟漪效应_Android_Material Design_Android Toolbar - Fatal编程技术网

Android 在工具栏中实现涟漪效应

Android 在工具栏中实现涟漪效应,android,material-design,android-toolbar,Android,Material Design,Android Toolbar,我试图在我的工具栏上添加这种连锁反应,但目前我不知道如何做到这一点 基于如何添加工具栏 <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/app_secondary_color" app:popu

我试图在我的工具栏上添加这种连锁反应,但目前我不知道如何做到这一点

基于如何添加工具栏

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:background="@color/app_secondary_color" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.ActionBar" > 
</android.support.v7.widget.Toolbar>
我应该把这个放在哪里

<com.andexert.library.RippleView
  android:id="@+id/more"
  android:layout_width="?android:actionBarSize"
  android:layout_height="?android:actionBarSize"
  android:layout_toLeftOf="@+id/more2"
  android:layout_margin="5dp"
  ripple:rv_centered="true">


</com.andexert.library.RippleView>
像这样使用它:

<com.andexert.library.RippleView
 android:id="@+id/more"
 android:layout_width="?android:actionBarSize"
 android:layout_height="?android:actionBarSize"
 android:layout_toLeftOf="@+id/more2"
 android:layout_margin="5dp"
 ripple:rv_centered="false">
   <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:background="@color/app_secondary_color" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.ActionBar" > 
   </android.support.v7.widget.Toolbar>

</com.andexert.library.RippleView>
在MainActivity中,如果工具栏是操作栏:

 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
    }

是否已将库包含在生成路径中?是。我把它用在我的按钮上了。我只是不知道如何在工具栏上使用它它在按钮上工作吗?我刚刚试过文本查看它工作…是的,它工作。你们是如何使用工具栏的?你们是将工具栏作为操作栏使用的吗?谢谢,巴德。它可以工作,但整个actionbar都有涟漪效应。涟漪效应有没有一种方法可以与动作按钮一起工作?我没有尝试过,但尝试将涟漪视图添加到按钮所在的xml中的动作按钮,例如main.xml,方法与将其应用到工具栏的方法相同。
    xmlns:ripple="http://schemas.android.com/apk/res-auto"
 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
    }