gpt4 book ai didi

android - PopupView 不显示?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:52:47 25 4
gpt4 key购买 nike

这是 XML(只是一个 WebView ):

<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/couponView" android:layout_height="100dp" android:layout_width="100dp" />

和代码:

final View cView = getLayoutInflater().inflate(R.layout.couponlayout, null);
PopupWindow pw = new PopupWindow(cView);
pw.showAtLocation(findViewById(R.id.mainLayout), Gravity.CENTER, 100, 100);
pw.update();

这是在 button.onClick() 方法中。当我单击按钮时,其余应该发生的事情(按钮改变颜色、文本等),但 PopupWindow 没有显示。我一直在梳理网络,但找不到任何修复程序。我做错了什么?

编辑:没有人知道发生了什么事?我觉得这是一个普遍的问题。

最佳答案

PopupWindow.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

注意:setWindowLayoutMode 已被弃用。使用 setHeight 和 setWidth。

关于android - PopupView 不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5504755/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com