Android:布局实例之模仿QQ登录界面

预览图:

准备:

1、找到模仿对象 QQ登陆界面UI下载>>>>>

2、导入工程

3、查看布局结构和使用控件

其对应效果图分布为

4、分析样式选择器

下拉箭头2种样式:点击和默认状态

文本框2种样式:聚焦和默认状态

复选框3种样式:选择、不选择和鼠标点着不放

左下角按钮2种样式:点击和默认

登录按钮2样式:点击和默认

============================================帖代码===========================

布局:

  1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:orientation="vertical" >
6
7 <include layout="@layout/head" />
8
9 <LinearLayout
10 android:layout_width="match_parent"
11 android:layout_height="wrap_content"
12 android:layout_weight="1.0"
13 android:background="@drawable/default_bg"
14 android:orientation="vertical" >
15
16 <RelativeLayout
17 android:layout_width="match_parent"
18 android:layout_height="wrap_content"
19 android:layout_marginLeft="15px"
20 android:layout_marginRight="15px"
21 android:layout_marginTop="63px"
22 android:background="@drawable/login_back"
23 android:paddingBottom="10px"
24 android:paddingTop="21px" >
25
26 <!-- QQ左栏logo -->
27
28 <ImageView
29 android:id="@+id/faceImg"
30 android:layout_width="wrap_content"
31 android:layout_height="wrap_content"
32 android:background="@drawable/qqfaceleft" />
33
34 <!-- 帐号文本框 -->
35
36 <EditText
37 android:id="@+id/login_edit_account"
38 android:layout_width="match_parent"
39 android:layout_height="wrap_content"
40 android:layout_alignParentTop="true"
41 android:layout_marginBottom="5px"
42 android:layout_marginLeft="5dp"
43 android:layout_marginRight="5dp"
44 android:layout_marginTop="5dp"
45 android:layout_toRightOf="@+id/faceImg"
46 android:background="@drawable/qq_edit_login"
47 android:paddingLeft="45sp"
48 android:text="输入帐号"
49 android:textColor="#ddd" />
50
51 <!-- 文本框左边帐号提示 -->
52
53 <TextView
54 android:layout_width="wrap_content"
55 android:layout_height="wrap_content"
56 android:layout_alignBottom="@+id/login_edit_account"
57 android:layout_alignLeft="@+id/login_edit_account"
58 android:layout_alignTop="@+id/login_edit_account"
59 android:layout_marginRight="15.0sp"
60 android:gravity="center_vertical"
61 android:paddingLeft="7sp"
62 android:text="帐号"
63 android:textSize="16dp" />
64
65 <!-- 下拉菜单按钮 -->
66
67 <ImageButton
68 android:layout_width="wrap_content"
69 android:layout_height="wrap_content"
70 android:layout_alignBottom="@+id/login_edit_account"
71 android:layout_alignRight="@+id/login_edit_account"
72 android:layout_alignTop="@+id/login_edit_account"
73 android:layout_marginRight="1dp"
74 android:background="@drawable/more_select" />
75
76 <!-- 密码文本框 -->
77
78 <EditText
79 android:id="@+id/login_edit_pwd"
80 android:layout_width="wrap_content"
81 android:layout_height="wrap_content"
82 android:layout_alignLeft="@+id/login_edit_account"
83 android:layout_alignRight="@+id/login_edit_account"
84 android:layout_below="@+id/login_edit_account"
85 android:background="@drawable/qq_edit_login"
86 android:paddingLeft="45sp"
87 android:text="输入帐号"
88 android:textColor="#ddd" />
89
90 <TextView
91 android:layout_width="wrap_content"
92 android:layout_height="wrap_content"
93 android:layout_alignBottom="@+id/login_edit_pwd"
94 android:layout_alignLeft="@+id/login_edit_pwd"
95 android:layout_alignTop="@+id/login_edit_pwd"
96 android:layout_marginRight="15.0sp"
97 android:gravity="center_vertical"
98 android:paddingLeft="7sp"
99 android:text="密码"
100 android:textSize="16dp" />
101
102 <!-- 记住密码选项 -->
103
104 <CheckBox
105 android:layout_width="wrap_content"
106 android:layout_height="wrap_content"
107 android:layout_alignBaseline="@+id/login_btn_login"
108 android:button="@drawable/qq_btn_check"
109 android:text="记住密码" />
110
111 <!-- 登录按钮 -->
112
113 <Button
114 android:id="@+id/login_btn_login"
115 android:layout_width="130px"
116 android:layout_height="42px"
117 android:layout_alignParentRight="true"
118 android:layout_below="@+id/login_edit_pwd"
119 android:layout_marginRight="7px"
120 android:layout_marginTop="12px"
121 android:text="登录" />
122 </RelativeLayout>
123 <!-- 复选框层 -->
124
125 <TableLayout
126 android:layout_width="match_parent"
127 android:layout_height="wrap_content"
128 android:layout_marginLeft="20px"
129 android:layout_marginRight="20px"
130 android:stretchColumns="1" >
131
132 <TableRow>
133
134 <CheckBox
135 style="@style/MyCheckBox"
136 android:layout_width="wrap_content"
137 android:layout_height="wrap_content"
138 android:text="隐身登录" />
139
140 <CheckBox
141 style="@style/MyCheckBox"
142 android:layout_width="wrap_content"
143 android:layout_height="wrap_content"
144 android:layout_gravity="right"
145 android:text="开启震动" />
146 </TableRow>
147
148 <TableRow>
149
150 <CheckBox
151 style="@style/MyCheckBox"
152 android:layout_width="wrap_content"
153 android:layout_height="wrap_content"
154 android:text="接收群消息" />
155
156 <CheckBox
157 style="@style/MyCheckBox"
158 android:layout_width="wrap_content"
159 android:layout_height="wrap_content"
160 android:layout_gravity="right"
161 android:text="静音登录" />
162 </TableRow>
163 </TableLayout>
164 </LinearLayout>
165 <!-- 底部 -->
166
167 <RelativeLayout
168 android:layout_width="match_parent"
169 android:layout_height="44dp"
170 android:background="@drawable/bottom"
171 android:gravity="center_vertical" >
172
173 <ImageButton
174 android:layout_width="wrap_content"
175 android:layout_height="wrap_content"
176 android:background="@drawable/option" />
177 </RelativeLayout>
178
179 </LinearLayout>

样式:

    <style name="MyCheckBox" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:textSize">16sp</item>
<item name="android:textColor">#7fffffff</item>
<item name="android:paddingLeft">28px</item>
<item name="android:button">@drawable/qq_btn_check</item>
</style>

样式选择器:

<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/btn_check_on" />
<item android:state_window_focused="false" android:state_enabled="true" android:state_checked="false" android:drawable="@drawable/btn_check_off" /> <item android:state_enabled="true" android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/btn_check_on_pressed" />
<item android:state_enabled="true" android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/btn_check_off_pressed" /> <item android:state_focused="true" android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/btn_check_on_selected" />
<item android:state_focused="true" android:state_enabled="true" android:state_checked="false" android:drawable="@drawable/btn_check_off_selected" /> <item android:state_enabled="true" android:state_checked="false" android:drawable="@drawable/btn_check_off" />
<item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/btn_check_on" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="false" android:drawable="@drawable/login_input"></item>
<item android:state_pressed="true" android:drawable="@drawable/login_input"></item>
<item android:state_focused="true" android:drawable="@drawable/input_over"></item>
</selector>
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/option_selected" />
<item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/option_selected" />
<item android:state_enabled="true" android:drawable="@drawable/option_normal" />
</selector>
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/button2_down" />
<item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/button2_over" />
<item android:state_enabled="true" android:drawable="@drawable/button2" />
</selector>

下载我的练习工程

相关文章:

Android:布局实例之模仿京东登录界面

[转]Android:布局实例之模仿QQ登录界面的更多相关文章

  1. Android:布局实例之模仿QQ登录界面

    预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布为 4.分析样式选择器 下拉箭头2种样式:点 ...

  2. Android:布局实例之模仿京东登录界面

    预览图及布局结构参考: 布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout ...

  3. java代码完全手写模仿qq登录界面

    这是我模仿QQ2015版界面,实现的基本功能有登陆验证,重置等,当然直接复制代码运行是不一样的,还要注意自己插入自己的图片. 结果截图如下所示: import java.awt.BorderLayou ...

  4. 界面编程模仿篇(QQ登录界面逼真篇)

    写了好多天的爬虫,偷空前前后后用了两天的时间(排除吃饭睡觉)写完了这个QQ登录界面,看起来还凑和着吧,如果是的大神的,莫见笑,纯属业余作品,废话先不多说,截图如下,其中第二幅图片中的红色方框部份有待完 ...

  5. Android菜鸟的成长笔记(3)——给QQ登录界面说So Easy

    原文:Android菜鸟的成长笔记(3)--给QQ登录界面说So Easy 上一篇:Android菜鸟的成长笔记(2)--第一个Android应用 我们前面已经做了第一个Android应用程序,虽然有 ...

  6. QQ登录界面布局

    简单的qq登录界面布局 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmln ...

  7. WPF开发实例——仿QQ登录界面

    原文:WPF开发实例--仿QQ登录界面 版权声明:本文为博主原创文章,如需转载请标明转载地址 http://blog.csdn.net/u013981858 https://blog.csdn.net ...

  8. WPF模仿QQ登录按钮

    原文:WPF模仿QQ登录按钮 如下图,第一张是未点击时按钮样式,第二张是鼠标划过时按钮样式. 样式代码: <Style TargetType="{x:Type Button}" ...

  9. swing实现QQ登录界面1.0( 实现了同一张图片只加载一次)、(以及实现简单的布局面板添加背景图片控件的标签控件和添加一个关闭按钮控件)

    swing实现QQ登录界面1.0( 实现了同一张图片只加载一次).(以及实现简单的布局面板添加背景图片控件的标签控件和添加一个关闭按钮控件) 代码思路分析: 1.(同一张图片仅仅需要加载一次就够了,下 ...

随机推荐

  1. ogg数据初始化历程记录

    之前,源端数据表结构发生改变,不知道前面的同事是怎么搞得(生成的数据定义文件不对,还是没有把进程启动),造成进程停止20天,然后重启复制进程,对比源端和目标端数据有差异(总共差10000多条数据),问 ...

  2. perl6 Socket

    Perl6 中的SOCKET就是相当于Perl5 的 IO::Socket::INET. 官方介绍如下: #下面是客户端multi method new( :$host, :$port, :, :$e ...

  3. Linux实用命令之xdg-open

    为什么要介绍 xdg-open 呢,得先从需求说起. 一般在控制台中,可以使用命令操作各式文本文件.但难以避免,需要操作一些非文本文件,如 pdf,doc 等. 此时,一般的做法是,打开文件管理器,再 ...

  4. iOS 取消按钮高亮显示方法

    objective-C 第1种方法: 设置按钮的normal 与 highlighted 一样的图片, 不过如果你也需要selected状态下的图片, 就不能这么做, 这样做在取消选中状态的时候就会显 ...

  5. python redis-string、list、set操作

    string操作 redis中的string在内存中都是按照一个key对应一个value来存储的 方法: set() 方法 : 写入一条数据 mset() 方法: 写入多条数据 , 可是Key-Val ...

  6. 【转】doxygen+graphviz生成工程中的类继承树及函数调用图

    转自----hequn8128 在阅读代码量比较多的项目时,类的继承树和函数调用图能够直观地向我们显示类之间或者函数之间的各种关系,方便我们了解程序的整体框架,很多时候可以起到事半功倍的作用.这里尝试 ...

  7. Regular Expression Matching——没理解的动态规划

    Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...

  8. 关于wordpress插件WP SMTP的邮箱设置

     花了两天的时间把邮箱设置好了,把大概的步骤写下,放一下查到的资料. 1.去域名服务商那里添加MX记录      如下图的MX      2.测试主机是否禁用了mail()函数      参考链接wo ...

  9. day1 作业二:多级菜单操作

    作业二:多级菜单 (1)三级菜单 (2)可以次选择进入各子菜单 (3)所需新知识点:列表.字典 要求:输入b返回上一层,输入q退出整个程序 思路:三级菜单第一级别是省,第二级别是市,第三级别是县,用户 ...

  10. python3环境下面bytes类型转换成字典类型实例

    场景:通过http://tool.chinaz.com/tools/httptest.aspx在线HTTP接口测试工具获取接口的返回信息 { "status": 0, " ...