Code example for PopupWindow

Methods: getContentViewsetContentViewsetOnDismissListenershowAsDropDown

0
		if (tView instanceof ViewBaseAction) {
			ViewBaseAction f = (ViewBaseAction) tView;
			f.show();
		} 
		//��������ͬһ��Tab��������һ��Tab��child����ΪpopupWindow������ 
		if (popupWindow.getContentView() != mViewArray.get(position)) {
			popupWindow.setContentView(mViewArray.get(position));
		} 
		popupWindow.showAsDropDown(this, 0, 0);//��ʾpopupWindow
	} 
 
	/** 
	 * �����˵���չ��״̬�����ò˵��ջ�ȥ 
	 */ 
	public boolean onPressBack() { 
		if (popupWindow != null && popupWindow.isShowing()) {
			popupWindow.dismiss();
			hideView(); 
			if (selectedButton != null) {
				selectedButton.setChecked(false);
			} 
			return true; 
		} else { 
			return false; 
		} 
 
	} 
 
	private void hideView() { 
		View tView = mViewArray.get(selectPosition).getChildAt(0);
		if (tView instanceof ViewBaseAction) {
			ViewBaseAction f = (ViewBaseAction) tView;
			f.hide();
		} 
	} 
 
	private void init(Context context) {
		mContext = context;
		displayWidth = ((Activity) mContext).getWindowManager().getDefaultDisplay().getWidth();
		displayHeight = ((Activity) mContext).getWindowManager().getDefaultDisplay().getHeight();
		setOrientation(LinearLayout.HORIZONTAL);//���������ó��е���ʾ��ʽ
	} 
 
	@Override 
	public void onDismiss() { 
		showPopup(selectPosition);
		popupWindow.setOnDismissListener(null);
	} 
 
	/*private OnButtonClickListener mOnButtonClickListener; 
 
	*//**