前几天用到了PopupWindow,在PopupWindow上面放了个ListView,在使用过程中遇到了以下问题:
一、PopupWindow上面的ListView无法点击;
二、PopupWindow上面ListView的高度调整;
三、PopupWindow无法用Back键取消。
下面来具体介绍一下PopupWindow的使用:
首先布局PopupWindow:1个ListView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/popListLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="@+id/father_lv"
android:layout_width="match_

本文详细介绍了在Android中如何使用PopupWindow显示一个包含ListView的弹窗,并解决ListView无法点击、高度调整以及如何通过Back键取消PopupWindow的问题。通过实例代码展示了PopupWindow的初始化、ListView的设置以及监听事件的实现。
最低0.47元/天 解锁文章
368

被折叠的 条评论
为什么被折叠?



