rippledrawable

RippleDrawable mask color, what is it for?

血红的双手。 提交于 2019-11-30 16:45:56
问题 In referring to the RippleDrawable for Android L, https://developer.android.com/reference/android/graphics/drawable/RippleDrawable.html, there's a way to mask away to contain the ripple effect within the view. The masking is done as <ripple android:color="#ff0000ff"> <item android:drawable="@drawable/white" /> </ripple> We could also mask it using <ripple android:color="#ff0000ff"> <item android:drawable="@drawable/black" /> </ripple> As mentioned in the document, the mask layer is not drawn

AppCompatButton backgroundTint API < 21

不羁的心 提交于 2019-11-30 07:19:41
问题 I want to use ripple effects on Buttons. AppCompat v22.1 added AppCompatButton and new functionalities to AppCompat tinting. My Layout: <android.support.v7.widget.AppCompatButton android:id="@+id/add_remove_button" android:layout_width="match_parent" android:layout_height="match_parent" android:backgroundTint="@color/primary" android:textColor="@android:color/white" android:text="Remove" /> On my API 22 test device the ripple effect works perfectly, but i'm coding for API 11 and unfortunately

Android Ripple Effect Overridden by Selected State

一个人想着一个人 提交于 2019-11-30 04:06:20
问题 After having been looking for a while I've not been able to find an answer to this... I have a recycler view with items which when selected have a red background and white text (beforehand the background is white and text is black). To do this I am using a selector. I have recently tried to add a ripple effect to this, but unless I long click on the item the background of the item goes straight to red without the ripple. I am assuming this is because the selector state state_selected

Lollipop RippleDrawable vs Selector for Pre-Lollipop

你说的曾经没有我的故事 提交于 2019-11-29 19:55:42
I have buttons with different draw9patch png as background. Currently the buttons are controlled by selector which look something like this: <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> For the Android Lollipop they have a RippleDrawable for the touch effect, which goes something like this:

AppCompatButton backgroundTint API < 21

你离开我真会死。 提交于 2019-11-29 02:52:40
I want to use ripple effects on Buttons. AppCompat v22.1 added AppCompatButton and new functionalities to AppCompat tinting. My Layout: <android.support.v7.widget.AppCompatButton android:id="@+id/add_remove_button" android:layout_width="match_parent" android:layout_height="match_parent" android:backgroundTint="@color/primary" android:textColor="@android:color/white" android:text="Remove" /> On my API 22 test device the ripple effect works perfectly, but i'm coding for API 11 and unfortunately backgroundTint needs API >= 21. How can i set the ripple effect to Buttons on older API versions? Just

Create a ripple drawable without transparency

核能气质少年 提交于 2019-11-29 01:58:29
I'm a bit lost about how to properly use Ripple Drawable. Let's say I have this drawable : <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="false" android:state_focused="true" android:drawable="@color/accent_color_light" /> <item android:state_pressed="true" android:drawable="@color/accent_color_light" /> <item android:drawable="@android:color/white" /> </selector> So it is a plain white background which changes to a light blue when it is focused or pressed. How can I get the same colors but with a ripple

Ripples on a shape with a transparent background

柔情痞子 提交于 2019-11-28 18:48:44
问题 I am using the following shape in my app <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="oval" > <solid android:color="@color/primary_light"/> <size android:height="80dp" android:width="80dp"/> </shape> </item> <item android:state_focused="true"> <shape android:shape="oval"> <stroke android:color="@color/primary_light" android:width="5dp"/> <size android:height="80dp" android

Android ripple background color

风格不统一 提交于 2019-11-28 18:11:29
I am using a ripple effect on my navigation drawer. I have set it like this and applied it to my ListView: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:drawable="@color/black_200" /> <item android:state_pressed="true" android:color="@color/black_200"> <ripple android:color="@color/black_400" /> </item> <item android:drawable="@color/white" /> </selector> I want the ripple background to remain the same like the normal activated state. Even when I define the color to be the same as the activated state, it gets darker and the

How to use RippleDrawable programmatically in code (not xml) with Android 5.0 Lollipop?

夙愿已清 提交于 2019-11-28 17:30:32
I have the following code for my ripple: <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight"> <item android:id="@+id/rip"> <shape android:shape="oval"> <solid android:color="?android:colorAccent"/> </shape> </item> </ripple> Now I want to give the user the possibility to choose own colors, so I need to create the ripple programmatically. I found this and I think this is the right way to do it, but I don't know how to handle with this. The ripple will be used here: <ImageButton android:id="@+id

Lollipop RippleDrawable vs Selector for Pre-Lollipop

主宰稳场 提交于 2019-11-28 15:50:00
问题 I have buttons with different draw9patch png as background. Currently the buttons are controlled by selector which look something like this: <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> For