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

旧巷老猫 提交于 2019-12-03 08:09:10

问题


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/



来源:https://stackoverflow.com/questions/22369055/i-want-to-make-slide-menu-with-3d-effect-like-the-below-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!