public class MainActivity3 extends AppCompatActivity {
private SlidingMenu slidingMenu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
slidingMenu=new SlidingMenu(this);
slidingMenu.setMode(SlidingMenu.LEFT);
View inflate = LayoutInflater.from(this).inflate(R.layout.left, null);
ImageView img = inflate.findViewById(R.id.img_left);
slidingMenu.setMenu(inflate);
//触摸全屏
slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
slidingMenu.attachToActivity(this,SlidingMenu.SLIDING_CONTENT);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
slidingMenu.showContent();
}
});
}
}
SlidingMenu 抽屉菜单
最新推荐文章于 2024-09-07 15:57:32 发布