1

I tried to implement the JFeinstein library to create a sliding menu. It is working if I make the slide gesture anywhere on the screen only on the left margin no. If i make there a slide gesture will change my view with the menu view and it will put it in the full screen which I don't want to ... can someone tell me why is that happening ?? my code is :

MainActivity.java

package com.example.studentsnotebook;

import android.annotation.SuppressLint;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;

import com.slidingmenu.lib.SlidingMenu;
import com.slidingmenu.lib.app.SlidingActivity;

@SuppressLint("NewApi")
public class MainActivity extends SlidingActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setBehindContentView(R.layout.activity_menu);
        Display display = getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        int width = size.x;
        int menu_width = width - width/3;
        if (menu_width < 100){
            menu_width = 100;
        }
        SlidingMenu menu = new SlidingMenu(this);
        menu.setBehindOffset(menu_width);
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        menu.setShadowWidth(menu_width/2);
        menu.setShadowDrawable(R.drawable.shadow);
        menu.setFadeDegree(0.35f);
        menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        menu.setMenu(R.layout.activity_menu);
        menu.setSlidingEnabled(true);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}
4

0 回答 0