我的應用程序中有一個PopupWindow。 這就是我初始化:PopupWindow不顯示
final FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(200, 200));
hashTagsWindow = new PopupWindow(frameLayout, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
hashTagsWindow.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
這就是我如何努力表現出來:
hashTagsWindow.showAsDropDown(binding.hash, 20, 20);
但我PopupWindow不顯示自身。
我已經嘗試解決一個問題?:
裹
.showAsDropDown(...)
到PopupWindow的應該表現出來的.post(Runnable)
和.runOnUiThread(Runnable)
所有方法。
PopupWindowCompat.showAsDropdown(...)
方法。
所有這些事情都沒有幫助我。
同時一個PopupMenu的類正確地顯示在相同的上下文。但我需要PopupWindow。
我應該怎麼做才能顯示PopupWindow?
你叫.show()因爲我看不出它有 – ADM
PopupWindow沒有.show()方法 –
對不起我得到ListPopupWindow混淆。 – ADM