rippledrawable

How to set state_selected in ripple drawable

假如想象 提交于 2019-12-03 01:00:49
问题 How to specify android:state_selected inside a RippleDrawable I have following xml for ripple drawable but background color doesn't show up when I set myView.setSelected(true); <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#DDDDDD" > <item android:id="@android:id/mask"> <shape> <solid android:color="@color/black" /> </shape> </item> <item android:state_selected="true"> <shape> <solid android:color="#EEEEEE" /> </shape>

how do I change the solid color of a ripple drawable?

≡放荡痞女 提交于 2019-12-02 20:15:33
问题 <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:attr/colorControlHighlight"> <item> <selector> <item android:state_selected="true"> <layer-list> <item android:left="-5dp" android:top="-5dp" android:right="-5dp"> <shape android:shape="rectangle"> <stroke android:width="3dp" android:color="@android:color/white"/> <solid android:color="@android:color/transparent"/> </shape> </item> </layer-list> </item> <item

How to trigger ripple effect on Android Lollipop, in specific location within the view, without triggering touches events?

感情迁移 提交于 2019-12-02 19:05:39
This is a short question: Suppose I have a View with the RippleDrawable as background. Is there an easy way to trigger the ripple from a specific position without triggering any touch or click events? Yes there is! In order to trigger a ripple programatically you have to set the state of the RippleDrawable with setState() . Calling setVisible() does NOT work! The Solution To show the ripple you have to set the state to pressed and enabled at the same time: rippleDrawable.setState(new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled }); The ripple will be shown as long as

How to set state_selected in ripple drawable

空扰寡人 提交于 2019-12-02 14:21:47
How to specify android:state_selected inside a RippleDrawable I have following xml for ripple drawable but background color doesn't show up when I set myView.setSelected(true); <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#DDDDDD" > <item android:id="@android:id/mask"> <shape> <solid android:color="@color/black" /> </shape> </item> <item android:state_selected="true"> <shape> <solid android:color="#EEEEEE" /> </shape> </item> <item> <color android:color="#FFFFFF" /> </item> </ripple> Sohaib Found the answer, just in

how do I change the solid color of a ripple drawable?

北战南征 提交于 2019-12-02 08:53:12
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:attr/colorControlHighlight"> <item> <selector> <item android:state_selected="true"> <layer-list> <item android:left="-5dp" android:top="-5dp" android:right="-5dp"> <shape android:shape="rectangle"> <stroke android:width="3dp" android:color="@android:color/white"/> <solid android:color="@android:color/transparent"/> </shape> </item> </layer-list> </item> <item android:state_selected="false"> <shape android:shape="rectangle"> <solid android:color="@android:color

Delay shared element transition to complete statelist animation

亡梦爱人 提交于 2019-12-02 08:38:58
问题 I've been trying out shared element transition on Lollipop. i have a recyclerview which loads some cards and one click the card expands to its details in the next activity. I have set a ripple effect and a StateListAnimator on the card. But those are not visible cause the transition starts before these effects are completed. Is there any way to delay the transition so that it can wait for the statelist animator and ripple to complete? Here is the code I use ActivityOptions options = null; if

Delay shared element transition to complete statelist animation

ⅰ亾dé卋堺 提交于 2019-12-02 04:35:17
I've been trying out shared element transition on Lollipop. i have a recyclerview which loads some cards and one click the card expands to its details in the next activity. I have set a ripple effect and a StateListAnimator on the card. But those are not visible cause the transition starts before these effects are completed. Is there any way to delay the transition so that it can wait for the statelist animator and ripple to complete? Here is the code I use ActivityOptions options = null; if (Utilities.isLollipop()) { options = ActivityOptions.makeSceneTransitionAnimation(this, Pair.create

RippleDrawable - Show Ripple Effect programmatically

佐手、 提交于 2019-12-01 03:42:41
I have a view with like this <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:background="@drawable/ripple" android:layout_centerVertical="true" android:layout_alignParentStart="true" /> And ripple.xml as <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight" > <item android:id="@android:id/mask" android:drawable="@android:color/white" /> </ripple> Everything works great. When i touch the view it gives me

RippleDrawable - Show Ripple Effect programmatically

半世苍凉 提交于 2019-12-01 00:53:08
问题 I have a view with like this <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:background="@drawable/ripple" android:layout_centerVertical="true" android:layout_alignParentStart="true" /> And ripple.xml as <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight" > <item android:id="@android:id/mask" android

Android Ripple Effect Overridden by Selected State

旧街凉风 提交于 2019-11-30 19:46:47
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 overrides the ripple on sate_pressed? Does anyone know if there is a way around this? Here is the selector code