Adding Ripple Effect to RecyclerView item

I figured out. The only thing that I had to do is to add this attribute: android:background=”?android:attr/selectableItemBackground” to the root element of the layout that my RecyclerView adapter inflates like that: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:paddingTop=”8dp” android:paddingBottom=”8dp” android:background=”?android:attr/selectableItemBackground” tools:background=”@drawable/bg_gradient”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:textSize=”17sp” android:layout_marginLeft=”15dp” android:layout_marginStart=”15dp” android:id=”@+id/shoppingListItem” android:hint=”@string/enter_item_hint” android:layout_centerVertical=”true” android:layout_alignParentLeft=”true” android:layout_alignParentStart=”true”/> <CheckBox android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”@string/shopping_list_item_checkbox_label” … Read more

How to animate a View with Translate Animation in Android

In order to move a View anywhere on the screen, I would recommend placing it in a full screen layout. By doing so, you won’t have to worry about clippings or relative coordinates. You can try this sample code: main.xml <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”vertical” android:id=”@+id/rootLayout”> <Button android:id=”@+id/btn1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”MOVE” android:layout_centerHorizontal=”true”/> … Read more

Complete Working Sample of the Gmail Three-Fragment Animation Scenario?

Uploaded my proposal at github (Is working with all android versions though view hardware acceleration is strongly recommended for this kind of animations. For non hardware accelerated devices a bitmap caching implementation should fit better) Demo video with the animation is Here (Slow frame rate cause of the screen cast. Actual performance is very fast) … Read more

Resizing layouts programmatically (as animation)

I wrote a ResizeAnimation for a similar purpose. It’s simple but costly. Java /** * an animation for resizing the view. */ public class ResizeAnimation extends Animation { private View mView; private float mToHeight; private float mFromHeight; private float mToWidth; private float mFromWidth; public ResizeAnimation(View v, float fromWidth, float fromHeight, float toWidth, float toHeight) { … Read more

Show DialogFragment with animation growing from a point

Being DialogFragment a wrapper for the Dialog class, you should set a theme to your base Dialog to get the animation you want: public class CustomDialogFragment extends DialogFragment implements OnEditorActionListener { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return super.onCreateView(inflater, container, savedInstanceState); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Set a … Read more