Android:布局实例之模仿京东登录界面
预览图及布局结构参考:

布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffF6F2ED" > <LinearLayout
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentTop="true"
android:background="@drawable/android_title_bg"
android:gravity="center_vertical"
android:orientation="horizontal" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:singleLine="true"
android:text="@string/login"
android:textColor="@android:color/white"
android:textSize="15sp" />
</LinearLayout> <ScrollView
android:id="@+id/login_scroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title" > <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > <ImageView
android:id="@+id/joy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:minHeight="75dp"
android:minWidth="75dp"
android:padding="3dp"
android:src="@drawable/login_dog" /> <LinearLayout
android:id="@+id/login_edit_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/joy"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:background="@drawable/login_layout_editor_bg"
android:orientation="vertical" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="47dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:orientation="horizontal" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/user_name"
android:textColor="@android:color/black"
android:textSize="17sp" /> <EditText
android:id="@+id/login_input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:background="#fffbfbfb"
android:singleLine="true" />
</LinearLayout> <View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ffc8c8c8" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="47dp"
android:gravity="center_vertical"
android:orientation="horizontal" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/user_password"
android:textColor="@android:color/black"
android:textSize="17sp" /> <EditText
android:id="@+id/login_input_password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fffbfbfb"
android:inputType="textPassword"
android:singleLine="true" /> <CheckBox
android:id="@+id/login_switchBtn"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:button="@drawable/login_hide_password_selector"
android:clickable="true" />
</LinearLayout>
</LinearLayout> <Button
android:id="@+id/login_btn"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_below="@+id/login_edit_layout"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_marginTop="13dp"
android:background="@drawable/login_layout_btn_bg"
android:text="@string/login"
android:textColor="@android:color/white"
android:textSize="15sp" /> <RelativeLayout
android:id="@+id/login_passfind_and_phonelogin"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_below="@+id/login_btn"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="13dp"
android:gravity="center_vertical" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="@string/find_password"
android:textColor="#ff288dfe"
android:textSize="15sp" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="@string/phone_register"
android:textColor="#ff288dfe"
android:textSize="15sp" />
</RelativeLayout> <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/login_passfind_and_phonelogin"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="13dp"
android:gravity="center_vertical" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:drawableLeft="@drawable/login_icon_wx"
android:drawablePadding="5dp"
android:drawableRight="@drawable/index_icon1"
android:gravity="center_vertical"
android:text="@string/weixin_login"
android:textColor="#ff787878"
android:textSize="15sp" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawableLeft="@drawable/login_icon_other"
android:drawablePadding="5dp"
android:drawableRight="@drawable/index_icon1"
android:gravity="center_vertical"
android:text="@string/other_login"
android:textColor="#ff787878"
android:textSize="15sp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
这次学习到的
文本框添加背景色可以取消掉默认背景
EditText父级加入以下属性,可以取消默认聚焦
android:gravity="center_vertical"
android:orientation="horizontal"
让文本单行显示的属性:
android:singleLine="true"
TextView添加图标可以用
android:drawableLeft="@drawable/login_icon_wx"
相关文章:
Android:布局实例之模仿京东登录界面的更多相关文章
- [转]Android:布局实例之模仿QQ登录界面
Android:布局实例之模仿QQ登录界面 预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布 ...
- Android:布局实例之模仿QQ登录界面
预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布为 4.分析样式选择器 下拉箭头2种样式:点 ...
- java代码完全手写模仿qq登录界面
这是我模仿QQ2015版界面,实现的基本功能有登陆验证,重置等,当然直接复制代码运行是不一样的,还要注意自己插入自己的图片. 结果截图如下所示: import java.awt.BorderLayou ...
- Android:布局实例之模仿微信Tab
微信Tab预览效果: 思路: 1.用TabHost+RadioGroup搭建基本布局,以RadioGroup代替TabWidget 2.设置按钮和文字的的样式和selector 3.创建相应的Acti ...
- Android:布局实例之常见用户设置界面
实现效果: 整理思路: 1.控件:文字TextView 和 右箭头ImageView 2.因为考虑到点击效果,设计为:最外层为全圆角,内层有四种情况,分别为上圆角.无圆角.下圆角和全圆角. 3.内层样 ...
- 微信小程序相关一、模仿京东静态登录页面
一.培训的第一天,基本上没有什么最新的东西,但是看到老师的代码收获的确实是不少. 1.1.首页代码很简洁,将共有的样式都提取的很好. 1.2.其次是每一个小块写样式的时候用到了好多子代选择器和后代选择 ...
- Android开发实例之miniTwitter登录界面的实现
原文: http://www.jizhuomi.com/android/example/134.html 本文要演示的Android开发实例是如何完成一个Android中的miniTwitter登录界 ...
- Android基础总结(3)——UI界面布局
Android的UI设计有好几种界面程序编写方式.大体上可分为两大类:一类是利用可视化工具来进行,允许你进行拖拽控件来进行布局:还有一类是编写xml文档来进行布局.这两种方法可以相互转换. 1.常见的 ...
- android内部培训视频_第五节(1)_OA实战之登录界面
第五节(1):OA实战之登录界面 一.登录界面布局 1.背景图片 2.文本框 3.checkbox 4.按钮 暂未实现点击切换图片效果 <RelativeLayout xmlns:androi ...
随机推荐
- Java案例之随机验证码功能实现
实现的功能比较简单,就是随机产生了四个字符然后输出.效果图如下,下面我会详细说一下实现这个功能用到了那些知识点,并且会把 这些知识点详细的介绍出来.哈哈 ,大神勿喷,对于初学Java的人帮助应该蛮大的 ...
- 【Python学习笔记】Pandas库之DataFrame
1 简介 DataFrame是Python中Pandas库中的一种数据结构,它类似excel,是一种二维表. 或许说它可能有点像matlab的矩阵,但是matlab的矩阵只能放数值型值(当然matla ...
- C++之容器
容器,迭代器与容器适配器 所谓容器,即是将最常运用的一些数据结构(data structures)用类模板实现出来,用于容纳特定类型的对象.根据数据在容器中排列的特性,容器可概分为序列式(sequen ...
- 一个gulp用于开发与生产的示例
gulp是一款流行的前端构建工具,可以帮我们完成许多工作:监听文件修改.刷新浏览器.编译Less/Scss.压缩代码.添加md5.合并文件等.gulp的配置和使用特别简单,学习gulp过程中顺便写了一 ...
- mycncart 前台代码跟踪
1.进入根目录的入口文件,index.php require_once(DIR_SYSTEM . 'startup.php');//最为重要的一步 start('catalog');//执行了这个方法 ...
- django 类列表实例化
一. 创建类 from rest_framework.views import APIView class Group(APIView): def get(self,request): pass cl ...
- C语言实现二叉排序树
程序以'#'结尾的二叉排序树. /*(双重指针 BSTree *T)问:数据结构中 二叉树建立结点为什么用 双重指针?详细解释下双重指针 答:指针的指针.因为树的结点要用指针描述.如果只用指针,作形参 ...
- [知识复习] C语言文件读写
文件打开 fopen() 返回FILE* 对象,如果打开失败返回NULL,错误代码存入errno中 FILE *fopen( const char * filename, const char * m ...
- 【转】Mac系统新建txt文本文件技巧
很多时候,我们需要在 Mac 中创建 txt 文件来记录一些信息,但是打开系统自带的文本编辑默认并不是创建 txt 文本文件 方法一: 打开终端,cd 到想要创建 txt 文本文件的目录(如桌面) 1 ...
- AC日记——[HNOI2008]玩具装箱toy bzoj 1010
1010 思路: 斜率优化DP: 跪烂大佬 代码: #include <bits/stdc++.h> using namespace std; #define maxn 50005 #de ...