Android编程:底部弹出的对话框
环境:
主机:WIN10
开发环境:Android Studio 2.2 Preview 3
说明:
在《Android编程:底部弹出的对话框》中实现了底部弹出的对话框。在此基础上实现通用的输入框,效果如下图所示。输入框类中通过回调机制通知活动,从而实现了活动与对话框的解耦。
效果图:
布局文件dialog_input.xml:
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp">
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="标题"/>
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:singleLine="true" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom&