rippledrawable

How to create ripple effect in simple layout

你离开我真会死。 提交于 2019-12-17 08:09:54
问题 How can I have a ripple effect in a simple linear/relative layout when touching the layout? I've tried setting the background of a layout to something like: <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight" > <item android:drawable="@android:color/white"/> </ripple> However I'm only seeing a plain white background and no ripple effect when touching the layout. What am I doing wrong? Edit:

How to add a ripple effect on a layout with rounded corners? [duplicate]

╄→гoц情女王★ 提交于 2019-12-14 00:54:58
问题 This question already has answers here : How to create ripple effect in simple layout (10 answers) Closed 2 years ago . I want to set a ripple effect on layout with rounded corners. How can I do it? 回答1: Use Following code. <?xml version="1.0" encoding="utf-8"?> <ripple android:color="@color/COLOR_WHILE_PRESSING" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/round_corner"></item> </ripple> round_corner.xml <?xml version="1.0" encoding="utf-8"?>

Why does heap size keep increasing?

别来无恙 提交于 2019-12-12 03:18:43
问题 I have an application that has a lot of ripple effects and animations. I tried going back and forth multiple screens, and also spam clicking buttons. I noticed that the heap size continuously goes up even though some screens have already been closed. When I checked the heap dump, the class with the highest Retained heap was the android.graphics.Bitmap class and points to all of the buttons I clicked that has a Ripple Effect. The Ripple Effects on the buttons are just simple ripples which uses

Android Ripple: How do other apps make their ripple so transparent without affecting the original colour of the view

别来无恙 提交于 2019-12-10 18:23:04
问题 When you look at other apps like yPlan or Google Play Store, their ripple effect on buttons is like a light grey or black that does not change the colour of the whole button. I want this same effect. Here is what i tried but its not the same This is my colour control highlight: Its a grey with 99% alpha <color name="colorHighlight">#fc8c969f</color> And this is my ripple drawer for my button <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res

Set background on TextView object and maintain ripple effect

旧巷老猫 提交于 2019-12-07 07:30:48
问题 I want to set the background of a TextView object programmatically, but also have a ripple effect for it. I can use with background set to android:selectableItemBackground , but the ripple effect gets lost, when setting the background. I also tried putting an ImageView together with the TextView in a FrameLayout . And set the image not as the background of the TextView , but as image of the ImageView : Yes, ripple is there, but it appears to be "behind" the image. Do I need to create a

ripple drawable crashes the app on Android API 19

社会主义新天地 提交于 2019-12-07 01:28:00
问题 I am using a custom ripple drawable <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime" android:color="@android:color/white"> <item android:id="@android:id/mask"> <shape android:shape="rectangle" > <solid android:color="@android:color/white" /> </shape> </item> </ripple> but it crashes the app on API 19 android.content.res.Resources$NotFoundException: File res / drawable /

Android L — Play Ripple Effect on View

十年热恋 提交于 2019-12-06 07:14:40
I am trying to play a ripple effect (from Android L) on a view at a certain time (not on the view being touched). To be specific, when the user successfully changes some text, I want a certain view to play a green ripple effect to show success. Is there any way to do this? I have tried putting a RippleDrawable in an Animation, putting the RippleDrawable as the background for my "success view." But, I can't figure out how to play the ripple animation as I have described. P.S. My project is Android L only right now, so I am not worried about backwards compatibility. Since your mask is just a

android ripple button with background

纵饮孤独 提交于 2019-12-06 03:49:28
问题 I successfully created a ripple button in android 5.0 using XML. My code is as follows: <?xml version="1.0" encoding="utf-8"?> <!-- the flat button to be used in app --> <!-- define the ripple --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight"> <!-- the ripple object --> <item android:id="@android:id/mask"> <!-- button shape (w/ radius) --> <shape android:shape="rectangle"> <!-- radius of vertices --> <corners android

Ripple effect on Spinner dropdown items colored background (appcompat-v7 V21)

回眸只為那壹抹淺笑 提交于 2019-12-05 22:09:52
问题 I tried to apply ripple effect on Spinner dropdown items, like this: activity.java ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( this, R.array.array_name, R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); Spinner mSpinner = (Spinner) findViewById(R.id.spinner); mSpinner.setAdapter(adapter); simple_spinner_dropdown_item.xml <?xml version="1.0" encoding="utf-8"?> <CheckedTextView xmlns:android="http://schemas

Ripple effect drawable is distorted when applied over 9patch background

最后都变了- 提交于 2019-12-05 18:34:20
I have a 9 patch drawable which I want to use as a background on a view. I want the view to show a ripple effect that follows the outline of a 9 patch when the view is clicked. Here's my activity, layout, and drawable code. MainActivity.kt: class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val click = findViewById<ConstraintLayout>(R.id.container) click.setOnClickListener { Toast.makeText(this, "Clicked", Toast.LENGTH_SHORT).show() } } } activity_main.xml: <?xml version="1.0"