安卓第九天---底部弹窗的PopWindow

本文介绍了在Android应用中创建底部弹窗PopWindow的思路和步骤,包括自定义布局、设置弹窗位置、添加动画效果。通过实例展示了如何响应TextView点击事件显示弹窗,以及如何为Button设置圆角背景和文字。同时,提供了pop_show和pop_hid动画资源文件的使用,并在MainActivity中编写关键代码实现。
摘要由CSDN通过智能技术生成

首先讲解一下底部弹窗的思路:
1.弹出的窗口也是一种布局,并不是固定的格式,需要我们自己去设置这个布局
2.弹窗的位置我们是可以自己去设置的,当然,具体的设置步骤需要自己去实现了(我不会告诉你们其他的我没有去学习的)
3.打开弹窗一般有一些动画效果,所以如果需要自己的弹窗变得生动,可以去设置动画效果
然后,这里给一个贴图,这里弹窗的触发事件就只是简单的点击TextView(HelloWorld)
在这里插入图片描述

然后弹窗的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">


<Button
    android:id="@+id/take_photo_from_camera"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/select_from_album"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="25dp"
    android:layout_marginRight="25dp"
    android:background="@drawable/btn_bg"
    android:text="@string/take_photo" />

<Button
    android:id="@+id/select_from_album"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:layout_marginLeft="25dp"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值