2011-02-09 7 views
0

팝업 창이 표시됩니다. 내가 ImageView의 클릭 이벤트에서 보여 주면, 나는 그것을 숨기라고 숨 깁니다. 그러나 ImageView의 Touch 이벤트에 표시하면 이벤트 호출이 취소되지만 팝업은 숨겨지지 않습니다. 이 오류의 원인은 무엇입니까? 어떻게 해결할 수 있습니까?PopUpWindow 문제를 닫습니다.

내가 팝업 창을 표시하는 데 사용되는 코드는

DisplayMetrics dm = new DisplayMetrics(); 
    getWindowManager().getDefaultDisplay().getMetrics(dm); 
    int width = dm.widthPixels; //320  
    CabotMessageHandler.printConsole("width of screen"+width); 

    //show Popup 
    LayoutInflater inflater = (LayoutInflater) 
     this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    popupView=inflater.inflate(R.layout.gallerytoppopup, null, false); 
    pw = new PopupWindow(
     popupView, 
     width, 
     30, 
     true); 
    // The code below assumes that the root container has an id called 'main' 
    pw.setAnimationStyle(R.anim.popupanimation); 
    pw.showAtLocation(this.findViewById(R.id.webview), Gravity.TOP, 0, 30); 

답변

0

마지막으로 내가 문제를 찾을 수 있습니다. 터치 이벤트가 두 번 호출되고 두 개의 팝업이 생성됩니다. 그것은 해산 될 때 Popup을 숨기지 않는 이유입니다. (한 개의 팝업 숨기기 및 다른 남아 있습니다).

관련 문제