通过包名启动应用,popupWindow等

来源:互联网 发布:mac系统连接电视hdmi 编辑:程序博客网 时间:2024/06/15 06:36
//通过包名启动应用
Intent intent = this.getPackageManager().getLaunchIntentForPackage("com.android.mms");startActivity(intent);
//popupWindwo的使用
        View contentView = inflater.inflate(R.layout.poput_item, null);//解析自定义的布局popupWindow = new PopupWindow(contentView, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, true);//设置外部可点击popupWindow.setOutsideTouchable(true);//设置背景popupWindow.setBackgroundDrawable(new BitmapDrawable());//设置动画popupWindow.setAnimationStyle(R.style.popupstyal);//显示在某个控件之下//popupWindow.showAsDropDown(mButton);//显示在界面某个位置popupWindow.showAtLocation(contentView, Gravity.LEFT|Gravity.CENTER_VERTICAL, 100,100 );backgAlpha(0.5);popupWindow.setOnDismissListener(new OnDismissListener(){@Overridepublic void onDismiss(){backgAlpha(1);}});
//设置背景透明度
public void backgAlpha(double d){WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();lp.alpha = (float) d; getActivity().getWindow().setAttributes(lp);}
0 0
原创粉丝点击