swap fragment in an activity via animation

Old questiion and you probably already figured it out, but for future reference: here’s what you use to set a custom animation when you replace a fragment via code: FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right); ft.replace(R.id.fragment_container, newFragment, “fragment”); // Start the animated transition. ft.commit(); Here is an example of the slide_in_left animation: <?xml version=”1.0″ encoding=”utf-8″?> … 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

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

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 do android screen coordinates work?

This image presents both orientation(Landscape/Portrait) To get MaxX and MaxY, read on. For Android device screen coordinates, below concept will work. Display mdisp = getWindowManager().getDefaultDisplay(); Point mdispSize = new Point(); mdisp.getSize(mdispSize); int maxX = mdispSize.x; int maxY = mdispSize.y; EDIT:- ** **for devices supporting android api level older than 13. Can use below code. Display … Read more

Android adding simple animations while setvisibility(view.Gone)

You can do two things to add animations, first you can let android animate layout changes for you. That way every time you change something in the layout like changing view visibility or view positions android will automatically create fade/transition animations. To use that set android:animateLayoutChanges=”true” on the root node in your layout. Your second … Read more

Show and hide a View with a slide up/down animation

With the new animation API that was introduced in Android 3.0 (Honeycomb) it is very simple to create such animations. Sliding a View down by a distance: view.animate().translationY(distance); You can later slide the View back to its original position like this: view.animate().translationY(0); You can also easily combine multiple animations. The following animation will slide a … Read more

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