List of usage examples for android.widget PopupWindow PopupWindow
public PopupWindow(View contentView, int width, int height)
Create a new non focusable popup window which can display the contentView.
From source file:ab.util.AbDialogUtil.java
/** * popupwindow//from www . j a va2s . co m */ public static PopupWindow showPopWindow3(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null; popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width); } popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); return popupWindow; }
From source file:ab.util.AbDialogUtil.java
public static MyPop showDatePopWindow(Context context, View contentView, View targetView) { // /*ww w. j a v a 2 s . c o m*/ yearArrayString = getYEARArray(2016, 30); monthArrayString = getDayArray(12); hourArrayString = getHMArray(24); minuteArrayString = getHMArray(60); // ?? c = Calendar.getInstance(); PopupWindow popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); popupWindow.setWidth(context.getResources().getDisplayMetrics().widthPixels); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); yearWV = (WheelView) contentView.findViewById(R.id.time_year); monthWV = (WheelView) contentView.findViewById(R.id.time_month); dayWV = (WheelView) contentView.findViewById(R.id.time_day); hourWV = (WheelView) contentView.findViewById(R.id.time_hour); minuteWV = (WheelView) contentView.findViewById(R.id.time_minute); // ? yearWV.setVisibleItems(5); monthWV.setVisibleItems(5); dayWV.setVisibleItems(5); hourWV.setVisibleItems(5); minuteWV.setVisibleItems(5); // yearWV.setLabel(""); monthWV.setLabel(""); dayWV.setLabel(""); hourWV.setLabel(""); minuteWV.setLabel(""); yearWV.setCyclic(true); monthWV.setCyclic(true); dayWV.setCyclic(true); hourWV.setCyclic(true); minuteWV.setCyclic(true); setData(); return new MyPop(popupWindow, yearWV, monthWV, dayWV, hourWV, minuteWV); }
From source file:ab.util.AbDialogUtil.java
/** * /*from w w w. j av a2 s . co m*/ */ public static MyPop showDatePopWindowDate(Context context, View contentView, View targetView) { // yearArrayString = getYEARArray(2016, 36); monthArrayString = getDayArray(12); hourArrayString = getHMArray(24); minuteArrayString = getHMArray(60); // ?? c = Calendar.getInstance(); PopupWindow popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); popupWindow.setWidth(context.getResources().getDisplayMetrics().widthPixels); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); yearWV = (WheelView) contentView.findViewById(R.id.time_year); monthWV = (WheelView) contentView.findViewById(R.id.time_month); dayWV = (WheelView) contentView.findViewById(R.id.time_day); hourWV = (WheelView) contentView.findViewById(R.id.time_hour); minuteWV = (WheelView) contentView.findViewById(R.id.time_minute); hourWV.setVisibility(View.GONE); minuteWV.setVisibility(View.GONE); // ? yearWV.setVisibleItems(5); monthWV.setVisibleItems(5); dayWV.setVisibleItems(5); hourWV.setVisibleItems(5); minuteWV.setVisibleItems(5); // yearWV.setLabel(""); monthWV.setLabel(""); dayWV.setLabel(""); hourWV.setLabel(""); minuteWV.setLabel(""); yearWV.setCyclic(true); monthWV.setCyclic(true); dayWV.setCyclic(true); hourWV.setCyclic(true); minuteWV.setCyclic(true); setData(); return new MyPop(popupWindow, yearWV, monthWV, dayWV, hourWV, minuteWV); }
From source file:ab.util.AbDialogUtil.java
/** * // ww w . j a v a2 s . c o m */ public static MyPop showDatePopWindowHour(Context context, View contentView, View targetView) { // hourArrayString = getHMArray(24); // ?? c = Calendar.getInstance(); PopupWindow popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); popupWindow.setWidth(context.getResources().getDisplayMetrics().widthPixels); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); hourWV = (WheelView) contentView.findViewById(R.id.time_hour); // ? hourWV.setVisibleItems(5); // hourWV.setLabel(":00"); hourWV.setCyclic(true); setHourData(); return new MyPop(popupWindow, yearWV, monthWV, dayWV, hourWV, minuteWV); }
From source file:org.xingjitong.LinphoneActivity.java
@SuppressLint("NewApi") private void initPopupWindow() { Log.v("yyppdebug", "yyppoption init 000"); view = getLayoutInflater().inflate(R.layout.option_menu, null); pop = new PopupWindow(view, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); pop.setOutsideTouchable(true);//from w ww .j av a 2s . c om // ?? mlayout_setting = (LinearLayout) view.findViewById(R.id.option_menu_aaa); mlayout_about = (LinearLayout) view.findViewById(R.id.option_menu_bbb); mlayout_exit = (LinearLayout) view.findViewById(R.id.option_menu_ccc); mlayout_setting.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (pop.isShowing()) { pop.dismiss(); isPopShowing = false; } //do somethiing LinphoneActivity.instance().changeCurrentFragment(FragmentsAvailable.TITTLE_SETTINGS, null); //----------------- } }); mlayout_about.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") public void onClick(View v) { if (pop.isShowing()) { pop.dismiss(); isPopShowing = false; } //do something... AlertDialog.Builder buildernew = new AlertDialog.Builder(LinphoneActivity.instance(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); String tmpmsg = "?????????www.wecare200.com"; buildernew.setIconAttribute(android.R.attr.alertDialogIcon); buildernew.setTitle("?"); buildernew.setMessage(tmpmsg); buildernew.setNegativeButton("?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); buildernew.create().show(); //--------------------------------------------------------- } }); mlayout_exit.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (pop.isShowing()) { pop.dismiss(); isPopShowing = false; } //do something... //LinphoneActivity.instance().exit(); //---------------------------------- startActivity(new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); } }); }
From source file:com.android.dialer.DialtactsFragment.java
/** * @author bbk wangchunhe//from w w w . j a v a2 s. c o m * @Date 2016/07/13 * initialize CallLogSelectPopupWindow */ private void initCallLogSelectPopupWindow() { if (mCallLogSelectPopupWindow == null) { LayoutInflater layoutInflater = LayoutInflater.from(this.getContext()); View contentView = layoutInflater.inflate(R.layout.dialtacts_call_log_select_popupwindow, mParentLayout, false); mCallLogSelectPopupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); contentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallLogSelectPopupWindow.dismiss(); } }); } mCallLogSelectPopupWindow.setTouchable(true); mCallLogSelectPopupWindow.setFocusable(true); mCallLogSelectPopupWindow.setOutsideTouchable(true); mCallLogSelectPopupWindow.setAnimationStyle(R.style.PopupWindowAinm); mCallLogSelectPopupWindow.setBackgroundDrawable(new BitmapDrawable()); mCallLogSelectPopupWindow.showAsDropDown(getActivity().getActionBar().getCustomView()); // mActionbarMenu.setImageResource(R.drawable.actionbar_menu_down_up); mDialtactsActionBarController.setActionMenuIcon(R.drawable.actionbar_menu_down_up); popupWindowItemSelect(mCallLogSelectPopupWindow); mCallLogSelectPopupWindow.update(); mCallLogSelectPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { // mActionbarMenu.setImageResource(R.drawable.actionbar_menu_down); mDialtactsActionBarController.setActionMenuIcon(R.drawable.actionbar_menu_down); } }); }