2012-12-16 24 views
4

我在我的android項目中放置了EditText上的PopupWindow。當將PopupWindow.setFocusable設置爲false時,軟鍵盤將不會顯示。並設置PopupWindow.setFocusable爲真時,該EditText集中和活動去睡覺! 在彈出窗口中的其他項目的工作,但返回鍵在手機上,然後點擊彈出外不會關閉它。 在此先感謝。專注於彈出窗口中的EditText讓活動進入休眠狀態

回答

2

我只是設置setBackgroundDrawablePopupWindow。一切似乎都OK!我很驚訝!

+0

發生了什麼,我的回答是無益的? –

+0

你的回答指示我正確的答案。 **謝謝阿里**(@AliImran)。 – Hossein

8

從我的項目的一些代碼可以幫助

 LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     PopupWindow share_popup = new PopupWindow(inflater.inflate(R.layout.share_dropdown, null, false), 162, LinearLayout.LayoutParams.WRAP_CONTENT, true); 
     share_popup.setOutsideTouchable(true); 
     share_popup.setTouchable(true); 
     share_popup.setFocusable(true); 
     Drawable image_saved = getResources().getDrawable(R.drawable.dummy_bg); 
     share_popup.setBackgroundDrawable(image_saved); 

這哪裏是R.drawable.dummy_bg透明圖像。

+1

謝謝您的回答。設置'setBackgroundDrawable'解決了我的問題!我很驚訝! – Hossein

+0

Thak你。 '新PopupWindow(inflater.inflate(R.layout.share_dropdown,空,假的),162,LinearLayout.LayoutParams.WRAP_CONTENT,真);''最​​後價值boolean''TRUE'解決我的問題。 – Gunaseelan

相關問題