Lollipop RippleDrawable vs Selector for Pre-Lollipop

1) Yes. See the documentation for RippleDrawable for more details on how layers are composited, but basically you want: <?xml version=”1.0″ encoding=”utf-8″?> <ripple xmlns:android=”http://schemas.android.com/apk/res/android” android:color=”?android:attr/colorControlHighlight”> <item android:drawable=”https://stackoverflow.com/questions/24607339/@drawable/yourninepatch” /> </ripple> Or to also handle the disabled state in a clean way, you might want: <?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_enabled=”false”> <nine-patch android:src=”https://stackoverflow.com/questions/24607339/@drawable/yourninepatch” … Read more

Android Button with rounded corners, ripple effect and no shadow

I finally solved it with below code. This achieve rounded corners for button. Also, for Android Version >= V21, it uses ripple effect. For earlier Android version, button color changes when it is clicked, based on android:state_pressed, android:state_focused, etc. In layout xml file: <Button style=”?android:attr/borderlessButtonStyle” android:id=”@+id/buy_button” android:layout_width=”0dp” android:layout_weight=”1″ android:layout_height=”match_parent” android:gravity=”center” android:background=”@drawable/green_trading_button_effect” android:textColor=”@android:color/white” android:text=”BUY” /> For … Read more

Android, setting background color of button loses ripple effect

You can add the ripple effect & background color with an additionnal ripple drawable: your layout : <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”> <Button android:id=”@+id/button_connect” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_marginTop=”20dip” android:fontFamily=”sans-serif” android:text=”Connect” android:background=”@drawable/ripple” android:textColor=”#FFFFFF” android:textSize=”18sp” /> </LinearLayout> ripple.xml (this is where you can add background color in addition to the ripple effect) : <?xml version=”1.0″ … Read more

Ripple effect over a RecyclerView item containing ImageView

add below code to your parent layout android:clickable=”true” android:focusable=”true” android:background=”?attr/selectableItemBackground” if you want custom ripple effect add this ripple_custom.xml in your drawable-v21 <?xml version=”1.0″ encoding=”utf-8″?> <ripple xmlns:android=”http://schemas.android.com/apk/res/android” android:color=”@color/colorHighlight”> <item android:id=”@android:id/mask” android:drawable=”@color/windowBackground” /> </ripple> to support older version add ripple_custom.xml in drawable <?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=”rectangle”> <solid android:color=”@color/colorHighlight” /> </shape> </item> … Read more

What should be the color of the Ripple, colorPrimary or colorAccent? (Material Design)

Use 26% alpha for colored ripples. Android L doesn’t support theme attributes in color state lists and the <ripple> element doesn’t have an alpha channel, but for bounded ripples you can do something like: <ripple xmlns:android=”http://schemas.android.com/apk/res/android” android:color=”?android:attr/colorAccent”> <item android:id=”@android:id/mask”> <color android:color=”#42ffffff” /> </item> </ripple> This won’t work for an unbounded ripple. Alternatively, since you know … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)