1. 程式人生 > >QQ右上角氣泡選單

QQ右上角氣泡選單

 //QQ右上角氣泡
    compile 'com.zaaach:toprightmenu:1.0'
TopRightMenu topRightMenu = new TopRightMenu(getActivity());
                topRightMenu
                        .setHeight(300)     //預設高度480
                        .setWidth(300)      //預設寬度wrap_content
                        .showIcon(true)     //顯示選單圖示,預設為true
                        .dimBackground(true)        //背景變暗,預設為true
                        .needAnimationStyle(true)   //顯示動畫,預設為true
                        .setAnimationStyle(R.style.TRM_ANIM_STYLE)
                        .addMenuItem(new MenuItem(R.mipmap.wanba_icon, "掃一掃"))
                        .addMenuItem(new MenuItem(R.mipmap.roo_icon, "紅包"))
//                        .addMenuItem(new MenuItem(R.mipmap.coach_icon, "面對面建群"))
                        .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() {
                            @Override
                            public void onMenuItemClick(int position) {
                                Toast.makeText(getActivity(), "點選選單:" + position, Toast.LENGTH_SHORT).show();
                            }
                        })
                        .showAsDropDown(mHomeOption, -225, 0);    //帶偏移量