是男人就下100层【第一层】——高仿微信界面(2)
来源:互联网 发布:如何注册手机淘宝店铺 编辑:程序博客网 时间:2024/04/29 23:19
接着上一篇《是男人就下100层【第一层】——高仿微信界面(1)》,本打算实现上一篇文章中的第二个界面,这一篇先来实现一下登陆界面吧,接下来我们来开始登录界面的制作。
界面布局文件:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" android:background="#eee" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" > <ImageView android:layout_width="80dp" android:layout_height="80dp" android:src="@drawable/copyright" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="微信" android:textColor="#000000" android:textSize="35sp" /> </LinearLayout> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:gravity="center" android:text="CSDN 阳光小强" android:textColor="#000" android:textSize="30dp" /> <Button android:id="@+id/main_login_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_style_green" android:gravity="center" android:paddingLeft="130dp" android:paddingRight="130dp" android:layout_marginTop="15dp" android:text="登录" android:textColor="#ffffff" android:textSize="18sp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="6dp" android:text="使用QQ号或者微信号登录" android:textSize="14sp" android:textColor="#444" /> <Button android:id="@+id/main_regist_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/btn_style_white" android:gravity="center" android:paddingLeft="130dp" android:paddingRight="130dp" android:text="注册" android:textColor="#000000" android:textSize="18sp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="6dp" android:gravity="center" android:text="【点击跳转到主界面】\n如果你没有QQ号,请注册" android:textSize="14sp" android:textColor="#444" /> </LinearLayout>
上面布局中值得注意的是Button的背景是一个自定义的drawable资源文件
<?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/btn_style_one_disabled" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/btn_style_one_pressed" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/btn_style_one_pressed" /> <item android:state_focused="true" android:drawable="@drawable/btn_style_one_focused" /> <item android:state_focused="false" android:drawable="@drawable/btn_style_one_normal" /></selector>分别设置了四种状态的背景图片(这里的图片是9patch的,详细请看:http://blog.csdn.net/dawanganban/article/details/17379193)新建一个Activity
public class LoginActivity extends Activity{@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.activity_login);}}上一篇中写的AppStart中启动LoginActivity
public class AppStart extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_start);new Handler().postDelayed(new Runnable(){@Overridepublic void run(){Intent intent = new Intent (AppStart.this,LoginActivity.class);startActivity(intent);AppStart.this.finish();}}, 1000);}}运行效果:
源代码下载:http://download.csdn.net/detail/lxq_xsyu/6966619
下一篇:http://blog.csdn.net/dawanganban/article/details/20009241
11 0
- 是男人就下100层【第一层】——高仿微信界面(2)
- 是男人就下100层【第一层】——高仿微信界面(1)
- 是男人就下100层【第一层】——高仿微信界面(3)
- 是男人就下100层【第一层】——高仿微信界面(4)
- 是男人就下100层【第一层】——高仿微信界面(5)
- 是男人就下100层【第一层】——高仿微信界面(6)
- 是男人就下100层【第一层】——高仿微信界面(7)
- 是男人就下100层【第一层】——高仿微信界面(8)
- 是男人就下100层【第一层】——高仿微信界面(9)
- 是男人就下100层【第一层】——高仿微信界面(10)
- 是男人就下100层【第三层】——高仿交通银行手机客户端界面
- 是男人就下100层【第二层】——帮美女更衣(2)
- 是男人就下100层【第四层】——Crazy贪吃蛇(2)
- 是男人就下100层【第二层】——帮美女更衣(1)
- 是男人就下100层【第四层】——Crazy贪吃蛇(1)
- 是男人就下100层【第四层】——Crazy贪吃蛇(3)
- 是男人就下100层
- 是男人就下100层【第五层】——换肤版2048游戏
- 386计算机毕业设计
- 关于 Windows 中的时区信息
- Access 在VBA中实现数据导出到Excel
- C++构造函数初始化列表——笔记
- 百钱买百鸡问题
- 是男人就下100层【第一层】——高仿微信界面(2)
- Ubuntu 下Mysql常用命令
- 分数拆分
- C语言经典算法100例-009-输出国际象棋棋盘
- HTML5 Video
- 读懂diff
- 简明Vim练级攻略
- 汇编指令: LGDT、LIDT、LLDT、LMSW、LOADALL、LOADALL286、LOCK、LODSB、LODSW、LODSD
- eclipse导入cocos2dx项目后,CDT无法编译