你的位置:首页 > 软件开发 > 操作系统 > Android项目实战(二十七):数据交互(信息编辑)填写总结

Android项目实战(二十七):数据交互(信息编辑)填写总结

发布时间:2016-11-16 18:00:10
前言:  项目中必定用到的数据填写需求。比如修改用户名的文字编辑对话框,修改生日的日期选择对话框等等。现总结一下,方便以后使用。注:  先写实现过程,想要学习的同学可以看看,不需要的同学可以直接拉到最下面复制代码使用。 一、文字编辑对话框看下效果图(仿知乎):包括:一个标题T ...

Android项目实战(二十七):数据交互(信息编辑)填写总结

前言:

  项目中必定用到的数据填写需求。比如修改用户名的文字编辑对话框,修改生日的日期选择对话框等等。现总结一下,方便以后使用。

注:

  先写实现过程,想要学习的同学可以看看,不需要的同学可以直接拉到最下面复制代码使用。

 

一、文字编辑对话框

看下效果图(仿知乎):

Android项目实战(二十七):数据交互(信息编辑)填写总结

包括:

一个标题TextView

一个圆角白色背景EditText

一个可输入个数提示的TextView

两个按钮,‘确定’、‘取消’ 

代码实现:

(1)编写布局文件

Android项目实战(二十七):数据交互(信息编辑)填写总结Android项目实战(二十七):数据交互(信息编辑)填写总结
<?"1.0" encoding="utf-8"?><LinearLayout "http://schemas.android.com/apk/res/android"  android:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:background="@color/grey_5"  android:id="@+id/popup_edit_info_ly"  >  <!--标题-->  <TextView    android:id="@+id/popup_edit_info_txt_title"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:text="title"    android:gravity="center_horizontal"    android:padding="@dimen/dp_6"    android:textColor="@color/black"    />    <!--编辑框-->  <EditText    android:id="@+id/popup_edit_info_edit_content"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_marginLeft="@dimen/dp_6"    android:layout_marginRight="@dimen/dp_6"    android:background="@drawable/bg_popup_edit"    android:maxLength="10"    android:padding="@dimen/dp_6"    >  </EditText>    <RelativeLayout    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:padding="@dimen/dp_6"    >    <!--提示文字-->    <TextView      android:id="@+id/popup_edit_info_txt_tip"      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:textSize="@dimen/txt_10"      android:text="剩余可输入个数:"      android:layout_centerVertical="true"      android:layout_marginLeft="@dimen/dp_6"      />        <!--确定按钮,这里用TextView ,当然也可以用Button ImageButton-->    <TextView      android:id="@+id/popup_edit_info_btn_confirm"      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:text="@string/confirm"      android:background="@drawable/bg_btn_blue"      android:padding="@dimen/dp_4"      android:textColor="@color/white"      android:layout_alignParentRight="true"      />    <!--取消按钮-->    <TextView      android:id="@+id/popup_edit_info_btn_cancel"      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:text="@string/cancel"      android:background="@drawable/bg_btn_grey"      android:padding="@dimen/dp_4"      android:textColor="@color/white"      android:layout_toLeftOf="@id/popup_edit_info_btn_confirm"      android:layout_marginRight="@dimen/dp_10"      />  </RelativeLayout></LinearLayout>

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:Android项目实战(二十七):数据交互(信息编辑)填写总结

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录