本文介绍了我想使滑动菜单,3D效果如下面的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用这种code键使滑块。但我不知道如何使它在3D。

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

进口com.navdrawer.SimpleSideDrawer;

公共类MainScreen扩展ActionBarActivity {
@覆盖
保护无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
的setContentView(R.layout.activity_main_screen);

如果(savedInstanceState == NULL){
    getSupportFragmentManager()的BeginTransaction()
            。新增(R.id.container,新PlaceholderFragment())提交()。
}
}

/ **
 *包含一个简单的视图的占位符片段。
 * /
公共静态类PlaceholderFragment扩展片段工具
    OnClickListener {
私人的ImageButton _Menu;
私人SimpleSideDrawer slide_me;

公共PlaceholderFragment(){
}

@覆盖
公共查看onCreateView(LayoutInflater充气,容器的ViewGroup,
        捆绑savedInstanceState){
    查看rootView = inflater.inflate(R.layout.fragment_main_screen,
            集装箱,假);
    slide_me =新SimpleSideDrawer(getActivity());
    slide_me.setLeftBehindContentView(R.layout.slider_menu_inflator);

    _Menu =(的ImageButton)rootView.findViewById(R.id.menu);
    _Menu.setOnClickListener(本);
    返回rootView;
}

@覆盖
公共无效的onClick(视图v){
    开关(v.getId()){
    案例R.id.menu:
        slide_me.toggleLeftDrawer();
        打破;

    默认:
        打破;
    }
}
}
}
 

解决方案

使用 AndroidResideMenu 库与3D效果制作幻灯片菜单

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;
    }
}
}
}
解决方案

Use AndroidResideMenu Library for make slide menu with 3D effect

这篇关于我想使滑动菜单,3D效果如下面的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 11:53