分享一个自定义的popuwindow效果,高度适配

本文介绍如何在项目中创建一个高度自适应并能居中显示的自定义PopupWindow,适用于追求炫酷效果的场景。通过布局文件和代码实现,详细展示了popupwindow.xml的设计和相关代码实现。
摘要由CSDN通过智能技术生成

在很多项目中我们可能会遇到这种效果。现在很多的应用效果都需要做的炫些,比如天天静听效果很炫的,源码已经对外开放了,有兴趣的可以去研究下;

直接上代码:

1.布局文件:

popwindow.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:background="@android:color/transparent">

<ListView
    android:id="@+id/listview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:dividerHeight="@dimen/divider_width_max"
    android:paddingTop="@dimen/padding_20"
    android:paddingLeft="@dimen/padding_10"
    android:paddingRight="@dimen/padding_10"
    android:divider="@color/color_diver"
    android:paddingBottom="@dimen/padding_10"
  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值