//弹出showPopWindow
public void showPopWindow() {
View view = LayoutInflater.from(this).inflate(R.layout.main_set, null);
view.findViewById(R.id.xfk_layout).getBackground().setAlpha(0); //透明度
TextView text1_kq = (TextView) view.findViewById(R.id.text1_kq_fregment); //考勤签到
//设置PopupWindow的显示大小
final PopupWindow window = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
window.setFocusable(true);//设置popupwindow可以获取焦点
//给pupupwindow设置一个背景 透明的,以便点击popupwindow外边时候可以实现消失
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.setOutsideTouchable(true);//设置点击外部消失
window.showAsDropDown(btn_fragment);//显示在按钮下方
//window.showAtLocation(view, Gravity.RIGHT,0,0);或者显示在指定父布局上边的指定位置
//考勤
text1_kq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
window.dismiss();
}
});
}