LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);

popupView = layoutInflater.inflate(R.layout.help_popup, null);

popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);

popupWindow.setFocusable(true);

popupWindow.setTouchable(true);

popupWindow.setOutsideTouchable(false);

popupWindow.getContentView().setFocusableInTouchMode(true);

popupWindow.getContentView().setOnKeyListener(new View.OnKeyListener() {

    @Override

    public boolean onKey(View v, int keyCode, KeyEvent event) {

        if (keyCode == KeyEvent.KEYCODE_BACK) {

            finish();

            return true;

        }

        return false;

    }

});

popupWindow.showAtLocation(mRootView, Gravity.CENTER, popPosX, popPosY);



저작자 표시 비영리 변경 금지
신고

'programmer > android' 카테고리의 다른 글

status bar  (0) 2013.07.08
highlighting via keyboad  (0) 2013.07.04
popupwindow example  (0) 2013.07.03
usb event broadcastreceiver  (0) 2013.07.03
ringtone/alarm tone 설정  (0) 2013.07.01
seekbar progress 위치에 value 표시  (0) 2013.06.25
Posted by ocsoosoo

댓글을 달아 주세요