rippledrawable

Add ripple effect to my button with button background color?

萝らか妹 提交于 2019-12-27 16:31:14
问题 I created a button and I want to add ripple effect to that button! I created a button bg XML file: (bg_btn.xml) <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFFFF" android:endColor="#00FF00" android:angle="270" /> <corners android:radius="3dp" /> <stroke android:width="5px" android:color="#000000" /> </shape> And this is my ripple effect file: (ripple_bg.xml) <ripple xmlns:android="http://schemas.android.com/apk

How to make a ripple effect over a linear layout, without overriding the background color on its children?

走远了吗. 提交于 2019-12-23 15:14:45
问题 I have a LinearLayout that looks like this. I want each row to be clickable. The LinearLayout code for a row looks like this: <LinearLayout style="@style/home_menu_item_container" android:id="@+id/home_menu_acronyms_button" > <ImageView style="@style/home_menu_item_left" android:background="@color/greyLight" /> <TextView style="@style/home_menu_item_right" android:text="@string/home_menu_option_2" android:background="@color/grey" /> </LinearLayout> How can I add a ripple effect that expands

Is this the right way to get the ripple effect on pre-lollipop devices?

孤街醉人 提交于 2019-12-23 12:52:51
问题 Material Design is out, and with it are some of the new magic features that have been hard to code using ordinary skills, which are supposedly only found in the Silicon Valley. Pun intended. Anyway, I'm trying to get the Ripple effect working on API<21, that is, pre-lollipop devices. In its most literal sense, the ripple effect, water, for that matter. Here's what I have tried. The approach is simple. I colour three layouts gray, three white, then the other three white and the three gray and

Android L — Play Ripple Effect on View

一个人想着一个人 提交于 2019-12-22 13:59:06
问题 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

Ripple effect drawable is distorted when applied over 9patch background

混江龙づ霸主 提交于 2019-12-22 10:54:39
问题 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 {

Ripples not showing with selectableItemBackground as foreground on a CardView with a Android 5.0 device

瘦欲@ 提交于 2019-12-22 03:48:37
问题 I'm running this on a Nexus 5. Here's part of the code for my CardView: CardView cardView = new CardView(getActivity()); cardView.setRadius(4); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 400); lp.setMargins(32, 16, 32, 16); cardView.setLayoutParams(lp); cardView.setContentPadding(50, 50, 50, 50); ... cardView.setForeground(selectedItemDrawable); And here's how I get the selectedItemDrawable: int[] attrs = new int[] { R.attr

ImageView selectableItemBackgroundBorderless does not render outside of view bounds

孤人 提交于 2019-12-21 09:06:26
问题 I am using selectableItemBackgroundBorderless to add a ripple to an ImageView . My expected behaviour would be to have a circular ripple, extending the views size. Unfortunately the ripple gets cropped by the view bounds. How can this issue be solved? Default state: Pressed state: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/nav_instruction_container" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android

Disable Ripple on ListView

你离开我真会死。 提交于 2019-12-21 07:38:26
问题 In Android 5.0, my ListView produces a ripple effect when clicking a list item. Is there a way to disable this effect? Looking at the docs, I don't see any way (https://developer.android.com/reference/android/widget/ListView.html) 回答1: You can remove or replace the list selector using the android:listSelector property. The default list selector under Material is ?android:attr/selectableItemBackground which is a bounded ripple. <ListView ... android:listSelector="@drawable/my_list_selector" />

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

自古美人都是妖i 提交于 2019-12-20 09:46:20
问题 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? 回答1: 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

Listview selector with colored background and ripple effect

♀尐吖头ヾ 提交于 2019-12-17 17:25:44
问题 Standard ListView selector in android L developer preview uses colorControlHighlight for the ripple effect on touch and has a transparent background in unfocused state. I would like to define a ListView item that has a colored background and still shows the ripple effect on touch with the same highlight color. Now, if I define the following drawable: <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight"> <item android:drawable="