标签: ripple

Ripple,colorPrimary或​​colorAccent的颜色应该是多少?(材料设计)

我已阅读材料设计指南,但如果它不是黑色(带alpha),我不知道Ripple的颜色应该是什么.

例如,我有一个colorPrimary = blue的应用程序,colorAccent = red.其实我使用的是colorAccent(带alpha),如果我想要一种不同于黑色的颜色,我应该使用colorPrimary(带alpha)?

我检查了谷歌的所有应用程序,但他们从不使用颜色的涟漪.

像我现在的图像:

波纹

android colors design-guidelines ripple material-design

48
推荐指数
5
解决办法
4万
查看次数

对包含ImageView的RecyclerView项目产生连锁反应

我有一个RecyclerView扩展以下网格项:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/children_tile_border"
    android:layout_marginTop="@dimen/children_tile_border"
    android:clickable="true"
    android:focusable="true"
    android:background="?selectableItemBackground"
    tools:ignore="RtlHardcoded">

        <com.example.app.ui.widget.SquareImageView
            android:id="@+id/child_picture"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="visible"
            android:layout_alignParentBottom="true"/>

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="68dp"
            android:background="@color/tile_text_background"
            android:gravity="center_vertical"
            android:layout_alignParentBottom="true">

            ..............
        </LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

但除非我将SquareImageView's可见性设置为不可见,否则不会出现涟漪效应.似乎涟漪效应低于SquareImageView.我怎么能把它画成SquareImageView

android ripple android-recyclerview

42
推荐指数
3
解决办法
3万
查看次数

Lollipop RippleDrawable vs Pre-Lollipop的选择器

我有不同的draw9patch按钮png作为背景.目前按钮的控制方式selector如下:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:drawable="@drawable/pressed" android:state_pressed="true"/>
  <item android:drawable="@drawable/disabled" android:state_enabled="false"/>
  <item android:drawable="@drawable/focused" android:state_focused="true"/>
  <item android:drawable="@drawable/default"/>
</selector>
Run Code Online (Sandbox Code Playgroud)

对于Android Lollipop,他们有RippleDrawable触摸效果,如下所示:

<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight">
    <item>
    ...
    </item>
</ripple>
Run Code Online (Sandbox Code Playgroud)

关于新的触摸波纹效果:

1:我可以将draw9patch设置为背景RippleDrawable吗?

2:我如何容纳以上两种不同的xml我想遵循材料设计?我是否必须为新的文件夹/布局xml分叉RippleDrawable

android material ripple rippledrawable android-5.0-lollipop

38
推荐指数
1
解决办法
3万
查看次数

Android,设置按钮的背景颜色会失去涟漪效果

在向Android按钮添加颜色后,它会失去其涟漪效果,使用户感觉有响应点击.我该如何解决?我已经搜索了很多解决方案,但我找不到一个不明确的明确解决方案.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".ClockInOutFragment">


    <AnalogClock
        android:id="@+id/clock"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/date_and_time"/>


    <RelativeLayout
        android:id="@+id/date_and_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp">

        <TextView
            android:id="@+id/time_digits"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="12:10"
            android:textSize="45sp"/>

        <TextView
            android:id="@+id/am_pm"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/time_digits"
            android:layout_toRightOf="@+id/time_digits"
            android:paddingLeft="3dp"
            android:text="PM"
            android:textSize="20sp"/>

        <TextView
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/time_digits"
            android:text="Mon, July 11"
            android:textSize="22sp"/>
    </RelativeLayout>

    <!--Clock in and out buttons-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal">

        <Button
            android:id="@+id/textView3"
            android:layout_width="0dp"
            android:layout_height="56dp"
            android:layout_weight="1"
            android:background="#4CAF50"
            android:gravity="center"
            android:text="Clock In"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#FFFFFF"/>

        <!--Divider between the clock in and out button-->
        <View
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:background="#B6B6B6"/>

        <Button …
Run Code Online (Sandbox Code Playgroud)

android click button effect ripple

24
推荐指数
5
解决办法
2万
查看次数

如何使用Ripple Emulator for Windows来测试PhoneGap应用程序?

可以使用Ripple模拟器在Windows下测试PhoneGap应用程序吗?

要么我做的事情非常糟糕,要么Ripple在这样的环境中根本不工作.

我已经从Chrome商店为Chrome安装了Ripple Emulator扩展程序.我将Chrome导航到我的移动应用程序(通过XAMPP在本地提供).我点击Chrome omnibar旁边的Ripple图标,然后点击Enable打开的窗口.我选择了合适的平台(Cordova 2.0).

我的应用程序以类似移动设备的外观重新加载,模拟移动设备.Ripple无法从config.xml文件中读取我的配置,但这是一个众所周知的错误(此处此处报告).我希望,这不是阻止我使用Ripple的问题吗?

我选择了我的设备(Samsung Nexus)并开始测试我的移动设备.即使第一次调用PhoneGap API也失败了.我试过罗盘,但我得到的只是Cannot call method 'watchHeading' of undefined.

如何定义基本的PhoneGap对象?我错过了什么?我可以使用Ripple Emulator在Chrome下的Windows下测试PhoneGap应用程序吗?或者我错过了Ripple的全部想法?

我试图用Ripple文档来帮助自己,但是" 启用Ripple模拟器 "这一章完全是垃圾.我没有连的迹象Start Ripple Services纹波图标(唯一的选择EnableDisable),当我点击Enable没有许可协议的迹象,我可以查看和接受.我觉得这个文件讲的是与我使用完全不同的东西.

如何在Chrome中使用Ripple来测试PhoneGap应用程序?我错过了什么?

ripple cordova

22
推荐指数
1
解决办法
4万
查看次数

PhoneGap Ripple Emulator始终报告格式错误的config.xml

有没有人有任何想法,什么可以导致Ripple Emulator(newesest版本)板载最新版本的Chrome 总是报告格式错误或丢失配置文件(" 在应用程序的根目录中找不到config.xml文件或格式错误的XML ")?

我的config.xml目前完全在应用程序根目录(即在同一个文件夹中index.html,用于触发我的移动应用程序的文件).我不认为它PhoneGap Bulid构建完美的应用程序(虽然仅在Android上测试)并且不会报告配置文件和编译过程中的任何问题.

我不仅在我自己的配置文件上,而且在我一直在使用的任何PhoneGap应用程序上收到此错误 - 包括:PhoneGap Hello World示例应用程序,alluny的PhoneGap启动应用程序,Sencha Touch Kitchen Sink演示以及其他.实际上我没有在我的本地资源中找到任何应​​用程序,这不会导致Ripple Emulator报告config.xml文件问题.

当然,我按照Ripple Emulator页面上的说明设置了正确的Chrome设置,我正在打开我的Chrome并使用正确的标记,以允许它通过file:/// protocol 访问本地文件.

ripple cordova phonegap-build

19
推荐指数
1
解决办法
9411
查看次数

Cordova 3 + Ripple

有人知道Ripple是否适用于最新的cordova版本?因为我正在尝试,我甚至无法启动控制面板.当我尝试没有它时,弹出一些"警报":

间隙:[ "插件管理", "启动", "PluginManager590841628"]

间隙:[ "应用", "显示", "App590841629"]

版本:Cordova 3 Ripple 0.9.16 Chrome 28.0.1500.95 m

google-chrome ripple cordova

18
推荐指数
2
解决办法
1万
查看次数

Android按钮带圆角,涟漪效果,无阴影

我正在尝试使用圆角构建Android按钮.但是沿着圆角(左下角和右下角),周围有不必要的灰色阴影.

圆角按钮

这是我的代码:

drawable/my_button.xml

<?xml version="1.0" encoding="utf-8"?>
  <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
      <shape android:shape="rectangle">
        <stroke android:width="1dp" android:color="#ffa6c575" />
        <solid android:color="#ffa6c575"/>
        <corners android:radius="15dp" />
      </shape>
    </item>
  </selector>
Run Code Online (Sandbox Code Playgroud)

然后在布局xml文件中,我有:

<LinearLayout
  <Button
    android:id="@+id/buy_button"
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="35dp"
    android:layout_gravity="center"
    android:background="@drawable/my_button"
    android:textColor="@android:color/white"
    android:text="BUY" />

  <View
    android:layout_width="10dp"
    android:layout_height="match_parent"
    android:background="@android:color/transparent" >
  </View>

  <Button
    android:id="@+id/sell_button"
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="35dp"
    android:layout_gravity="center"
    android:background="@drawable/my_button"
    android:textColor="@android:color/white"
    android:text="SELL" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

1)如何摆脱圆角(左下角和右下角)的额外灰色阴影?

2)按钮具有默认的波纹效果.如何保持默认的连锁效果?

android button rounded-corners ripple

18
推荐指数
4
解决办法
2万
查看次数

在图像视图上设置涟漪效果

得到以下图片视图:

<ImageView
    android:id="@+id/header"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:scaleType="centerCrop"
    app:layout_collapseMode="parallax" 
    android:clickable="true"
    android:focusable="true"
    android:background="?android:attr/selectableItemBackground"/>
Run Code Online (Sandbox Code Playgroud)

如果我没有为图像视图设置位图,则Ripple工作得很好.但是一旦我设置了这样的位图,涟漪效应就消失了:

ImageView iv=((ImageView)rootView.findViewById(R.id.header));
iv.setImageBitmap(myBitmap);
Run Code Online (Sandbox Code Playgroud)

这是我的ripple.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:colorAccent" />
        </shape>
    </item>
</ripple>
Run Code Online (Sandbox Code Playgroud)

我猜这个位图隐藏了涟漪效应,我怎样才能让它可见?已经尝试过:

  1. 将android:background更改为android:foreground,这不起作用.
  2. 在此顶部配置另一个透明ImageView,但由于它是透明的纹波未显示.

有任何想法吗?我见过Lollipop Contacts也是这样做的.

java android ripple android-5.0-lollipop

17
推荐指数
3
解决办法
2万
查看次数

如何禁用Android Lollipop ripple的alpha值?

我有一个使用自定义颜色的波纹.但是,颜色永远不会完全不透明.根据什么应该是Ripple的颜色,colorPrimary或​​colorAccent的答案?(材料设计)它总是具有40%的alpha值.看看答案我试图使用以下v21特定的drawable xml强制选择不透明的红色背景:

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="#ffff0000">
    <item android:id="@android:id/mask">
        <color android:color="#ffffffff" />
    </item>
</ripple>
Run Code Online (Sandbox Code Playgroud)

但是,我总是得到一个阿尔法红色,而不是我想要的不透明红色.是否有可能产生不透明的波纹?这是波纹的屏幕截图,其中红色永远不会完全不透明.

在此输入图像描述

你可以在https://github.com/gradha/Stackoverflow33217896上找到一个简单的涟漪效应示例,使用XML涟漪和另一个由代码生成的涟漪效应.后者表明,如果不重写代码,就不可能实现不透明的纹波.

android colors design-guidelines ripple material-design

15
推荐指数
1
解决办法
755
查看次数