2011-02-09 17 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

最終的に私は問題を見つけることです。タッチイベントが2回呼び出され、2つのポップアップが作成されます。これは、ポップアップを非表示にしない理由です(ポップアップが1つ隠れて残ります)。