package com.example.day03_menu;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.Toast;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
public class MainActivity extends SlidingFragmentActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
show();
}
private void show() {
//设置侧滑菜单的布局文件
setBehindContentView(R.layout.menu);
//得到fergment管理者
FragmentManager fragmentManager = getSupportFragmentManager();
//开启事务
FragmentTransaction transaction = fragmentManager.beginTransaction();
//提交事务
transaction.replace(R.id.fragment_menu, new MyFragment(),"right").commit();
//得到slidingMenu实例
SlidingMenu slidingMenu = getSlidingMenu();
//设置滑出方向模式
slidingMenu.setMode(SlidingMenu.RIGHT);
//设置滑出位置
slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
//设置渐变
slidingMenu.setFadeDegree(0.5f);
//设置滑出后,Activity剩余的宽度
slidingMenu.setBehindOffset(100);
}
/**
*友盟第三方登录
*/
public void UM(){
Toast.makeText(this, "进行第三方登录 ", 1).show();
}
}