14

enter image description here

I am able to make the slider by using this code. But I dont know how to make it in 3D.

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageButton;

import com.navdrawer.SimpleSideDrawer;

public class MainScreen extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main_screen);

if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction()
            .add(R.id.container, new    PlaceholderFragment()).commit();
}
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment implements
    OnClickListener {
private ImageButton _Menu;
private SimpleSideDrawer slide_me;

public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main_screen,
            container, false);
    slide_me = new SimpleSideDrawer(getActivity());
    slide_me.setLeftBehindContentView(R.layout.slider_menu_inflator);

    _Menu = (ImageButton) rootView.findViewById(R.id.menu);
    _Menu.setOnClickListener(this);
    return rootView;
}

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.menu:
        slide_me.toggleLeftDrawer();
        break;

    default:
        break;
    }
}
}
}
Sajad Karuthedath
  • 14,987
  • 4
  • 32
  • 49
Pankaj Arora
  • 10,224
  • 2
  • 37
  • 59

2 Answers2

12

Use AndroidResideMenu Library for make slide menu with 3D effect

Renjith Krishnan
  • 2,446
  • 5
  • 29
  • 53
  • I did it. In ResideMenu.buildScaleDownAnimation change scaleDown.playTogether(ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)); add ObjectAnimator.ofFloat(target, "rotationY", -20) and in ResideMenu.buildScaleUpAnimation change scaleUp.playTogether(ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)); add ObjectAnimator.ofFloat(target, "rotationY", 0) – Alhaytham Alfeel Mar 26 '14 at 15:35
  • @Nevaeh go to Library project and open residemenu_item.xml add a linear layout under the textview with height 2 dp. By this you can create a divider – Renjith Krishnan Sep 17 '14 at 06:57
  • please give me the residemenu_item.xml full file – Renjith Krishnan Sep 17 '14 at 08:39
  • Please see this http://stackoverflow.com/questions/25887088/how-to-add-divider-to-items-in-androidresidemenu – Nevaeh Sep 17 '14 at 09:39
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61404/discussion-between-renjith-krishnan-and-nevaeh). – Renjith Krishnan Sep 17 '14 at 10:41
1

To give it a 3D translation effect, you need to put a camera in front of the view and then translate the camera and also change the angle with it. Check the code below for similar kind of effect to imageview. You can pick that part of the code and modify as per your need:

https://code.google.com/p/android-coverflow/

Sushil
  • 8,250
  • 3
  • 39
  • 71
  • dude its a slider menu like facebook when we tap on that menu button in custom title bar then menu will open like the image i had post and activity will move to the right side with 3d animation.well the coverflow is totally diffrent with this flow. @Sushil – Pankaj Arora Mar 13 '14 at 04:48
  • @Pankaj.. I know you are talking about slider menu like in FB. Dont focus on Coverflow design. Just focus on the code which gives its 3D translation. Its by moving the camera sideways and away from a view. Try adding this kind of animation to your slider menu code. – Sushil Mar 13 '14 at 05:09
  • i got the logic dude.thnx – Pankaj Arora Mar 13 '14 at 05:47