我想制作具有3D效果的幻灯片菜单,如下图所示

时间:2014-03-13 04:25:17

标签: android animation user-interface navigation-drawer

enter image description here

我可以使用此代码制作滑块。但我不知道如何用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;
    }
}
}
}

2 个答案:

答案 0 :(得分:12)

使用 AndroidResideMenu库制作具有3D效果的幻灯片菜单

答案 1 :(得分:1)

要为其提供3D平移效果,您需要将相机放在视图前面,然后翻译相机并使用它更改角度。检查下面的代码,了解与imageview类似的效果。您可以选择该部分代码并根据需要进行修改:

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