i want to make slide menu with 3D effect like the

2019-03-11 03:52发布

问题:

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;
    }
}
}
}

回答1:

Use AndroidResideMenu Library for make slide menu with 3D effect



回答2:

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/