android 登陆输入框的实现
来源:互联网 发布:javascript动画教程 编辑:程序博客网 时间:2024/05/16 04:29
第一次写博客,把自己学到的一点一滴分享出来,方便别人借鉴,也有助于自己的学习。写的不好请见谅,正在进步中。
先看一下效果图
mainActivity中不需要增加什么代码,主要看main.xml中
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.shurukuang.MainActivity"> <LinearLayout android:layout_marginTop="100dp" android:layout_centerHorizontal="true" android:layout_width="300dp" android:layout_height="wrap_content" android:background="@drawable/shape_tousu" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:gravity="center" android:orientation="horizontal"> <TextView android:id="@+id/login_yisheng_tv" android:clickable="true" android:layout_weight="1" android:textSize="18dp" android:paddingLeft="18dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="用户名"/> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#cbcece" /> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:gravity="center_vertical"> <EditText android:id="@+id/login_shoujihaoma_ed" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="18dp" android:textSize="15dp" android:background="@null" android:hint="密码"/> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#cbcece" /> <LinearLayout android:layout_width="match_parent" android:gravity="center_vertical" android:layout_height="40dp"> <EditText android:id="@+id/login_mima_ed" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="18dp" android:textSize="15dp" android:background="@null" android:inputType="textPassword" android:hint="手机号"/> </LinearLayout> </LinearLayout></RelativeLayout>主要是在大的LinearLayout中设置一个drawable/shape_tousu 然后用view分成一格一格的。
shape_tousu.xml放在drawable中
<?xml version="1.0" encoding="utf-8"?><!--矩形的--><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#ffffff"/> <padding android:left="1dp" android:right="1dp" android:top="1dp"/> <stroke android:color="#a3a3a3" android:width="2px" /> <corners android:radius="6dp"/></shape>solid:填充的颜色,padding:各方向的间隔,stroke:边框,corners:圆角
这个功能的实现就是这样,如果有什么问题欢迎给我留言。
1 0
- android 登陆输入框的实现
- 控制台绘制登陆框(四) 实现简单的字符输入
- win32 API 实现登陆输入框
- android的登陆界面实现
- Android 登陆功能的实现。
- Android登陆用户的实现
- Android登陆界面实现-支持输入框清楚和震动效果功能
- 限制输入次数的系统登陆的实现
- android输入框EditText输入银行卡,输入手机,输入身份证格式化的实现
- 转 Android 带清除功能的输入框控件ClearEditText,仿IOS的输入框 登陆界面
- 一个Android登陆的简单实现
- 实现android的 google第三方登陆!
- android登陆记住密码的实现
- 实现android的 google第三方登陆
- android 简单登陆注册的实现
- Android仿微信带清除功能的输入框ClearEditText的实现
- Android 实现多个输入框的对话框
- 【Android】实现动态显示隐藏密码输入框的内容
- Python中split函数用法
- sql 优化方案
- Android 第十天重置版 _Media
- SIP transactions and dialogs
- 使用MediaPlayer和SurfaceView播放视频
- android 登陆输入框的实现
- 扣丁学堂笔记第21天Bitmaps与优化
- iOS9之后http请求失败解决方案
- iOS如何添加自定义UIWebView的HTTP请求头
- javascript eval()函数
- InitializingBean
- Fragment信息交互之不同Activity获取信息方式
- C++输入数据流用回车符判断终止
- 转载:史上最全在xampp与phpstorm环境下安装xdebug