android 底部弹出输入框,Android编程:底部弹出输入框

本文介绍了如何在Android应用中实现底部弹出的输入框对话框。内容包括布局文件dialog_input.xml的设计,InputDialogInterface接口的定义,InputDialog类的实现,以及如何初始化和展示输入框对话框。通过回调机制,实现了活动与对话框之间的解耦。
摘要由CSDN通过智能技术生成

Android编程:底部弹出的对话框

环境:

主机:WIN10

开发环境:Android Studio 2.2 Preview 3

说明:

在《Android编程:底部弹出的对话框》中实现了底部弹出的对话框。在此基础上实现通用的输入框,效果如下图所示。输入框类中通过回调机制通知活动,从而实现了活动与对话框的解耦。

效果图:

0818b9ca8b590ca3270a3433284dd417.png

布局文件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&

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值