编写xml文件没有任何要求,如同平时写自定义View或Activity那样编写您的布局即可。
在编写xml时,我们仅关注我们要展示的内容,背景蒙层相关的内容无需在此编写。
根布局的layout_gravity功能同BasePopup的Gravity功能 ,决定您的Popup展示在哪个位置
示例
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:background="@drawable/bg_round_white_8dp">
<TextView
android:id="@+id/tv_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="@dimen/default_padding"
android:textColor="@color/text_black2"
android:textSize="@dimen/text_large"
tools:text="动画展示" />
</FrameLayout>