本篇记录自定义AlertDialog以及遇到的问题
自定义AlertDialog
先上效果图
创建布局
首先我们要创建想要的dialog布局文件
<?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="200dp"
android:background="@drawable/style_linearlayout_round_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="@string/penaltyType"
android:gravity="center"
android:textColor="@color/colorAccent" />
<Spinner
android:id="@+id/sp_penalty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/penaltyArray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:text=