//通过包名启动应用
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()
{
@Override
public void onDismiss()
{
backgAlpha(1);
}
});
//设置背景透明度
public void backgAlpha(double d)
{
WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
lp.alpha = (float) d;
getActivity().getWindow().setAttributes(lp);
}