本文简单实现常用客户登录界面,如qq,微薄等客户端登录。
短暂停留界面:
登录界面:
实现比较简单,首先是短暂停留界面布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:layout_width ="fill_parent"
android:layout_height ="fill_parent"
android:scaleType ="fitXY"
android:src ="@drawable/splash" />
</LinearLayout>
该界面对应的Activity:
/**
* 应用启动短暂停留界面
* @author builder
*
*/
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable() {
public void run() {
Intent intent=new Intent(SplashActivity.this,LoginActivity.class);
startActivity(intent);
SplashActivity.this.finish();//结束本Activity
}
}, 1000);//设置执行时间
}
}
登录界面布局:
<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">
<ImageView
android:id ="@+id/loginbutton"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_centerHorizontal ="true"
android:layout_marginTop ="50dp"/>
<LinearLayout
android:id ="@+id/input"
android:layout_width ="fill_parent"
android:layout_height ="wrap_content"
android:layout_below ="@id/loginbutton"
android:layout_marginLeft ="28.0dip"
android:layout_marginRight ="28.0dip"
android:orientation ="vertical" >
<LinearLayout
android:layout_width ="fill_parent"
android:layout_height ="44.0dip"
android:gravity ="center_vertical"
android:orientation ="horizontal" >
<EditText
android:id ="@+id/searchEditText"
android:layout_width ="0dp"
android:layout_height ="fill_parent"
android:layout_weight ="1"
android:background ="@null"
android:ems ="10"
android:hint="输入帐号"
android:imeOptions ="actionDone"
android:singleLine ="true"
android:textSize ="16sp" >
<requestFocus />
</EditText>
<Button
android:id ="@+id/button_clear"
android:layout_width ="20dip"
android:layout_height ="20dip"
android:layout_marginRight ="8dip"
android:visibility ="visible" />
</LinearLayout>
<View
android:layout_width ="fill_parent"
android:layout_height ="1.0px"
android:layout_marginLeft ="1.0px"
android:layout_marginRight ="1.0px"
android:background ="#ffc0c3c4" />
<EditText
android:id ="@+id/password"
android:layout_width ="fill_parent"
android:layout_height ="44.0dip"
android:gravity ="center_vertical"
android:background ="#00ffffff"
android:inputType ="textPassword"
android:hint="输入密码"
android:maxLength ="16"
android:maxLines ="1"
android:textColorHint ="#ff666666"
android:textSize ="16.0sp" />
</LinearLayout >
<Button
android:id ="@+id/buton1"
android:layout_width ="270dp"
android:paddingTop ="5.0dip"
android:layout_height ="50dp"
android:layout_marginLeft ="28.0dip"
android:layout_marginRight ="28.0dip"
android:layout_marginTop ="12.0dip"
android:layout_below ="@+id/input"
android:gravity ="center"
android:textSize ="20dp"
android:text = "登录" />
<RelativeLayout
android:id ="@+id/relative"
android:layout_width ="fill_parent"
android:layout_height ="wrap_content"
android:layout_alignLeft ="@+id/input"
android:layout_alignRight ="@+id/input"
android:layout_below ="@id/buton1" >
<CheckBox
android:id ="@+id/auto_save_password"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_alignParentLeft ="true"
android:background ="@null"
android:drawableLeft="@drawable/cpasswd"
android:button ="@null"
android:checked ="true"
android:drawablePadding ="4.0dip"
android:text = "记住密码"
android:textSize ="12.0sp" />
<Button
android:id ="@+id/regist"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_alignParentRight ="true"
android:clickable ="true"
android:gravity ="left|center"
android:paddingLeft ="8.0dip"
android:paddingRight ="18.0dip"
android:text = "注册新账号"
android:textSize ="12.0sp" />
</RelativeLayout >
<LinearLayout
android:id ="@+id/more_bottom"
android:layout_width ="fill_parent"
android:layout_height ="wrap_content"
android:layout_alignParentBottom ="true"
android:orientation ="vertical" >
<RelativeLayout
android:id ="@+id/input2"
android:layout_width ="fill_parent"
android:layout_height ="40dp"
android:orientation ="vertical" >
<ImageView
android:id ="@+id/more_image"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_centerVertical ="true"
android:layout_marginRight ="5.0dip"
android:layout_toLeftOf ="@+id/more_text"
android:clickable ="false"/>
<TextView
android:id ="@+id/more_text"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_centerInParent ="true"
android:background ="@null"
android:gravity ="center"
android:maxLines ="1"
android:text = "更多登陆选项"
android:textSize ="14.0sp" />
</RelativeLayout >
<LinearLayout
android:id ="@+id/morehidebottom"
android:layout_width ="fill_parent"
android:layout_height ="wrap_content"
android:orientation ="vertical"
android:visibility ="gone" >
<View
android:layout_width ="fill_parent"
android:layout_height ="1.0px"
android:background ="#ff005484" />
<View
android:layout_width ="fill_parent"
android:layout_height ="1.0px"
android:background ="#ff0883cb" />
<LinearLayout
android:layout_width ="fill_parent"
android:layout_height ="wrap_content"
android:layout_marginLeft ="30.0dip"
android:layout_marginRight ="30.0dip"
android:layout_marginTop ="12.0dip"
android:orientation ="horizontal" >
<CheckBox
android:id ="@+id/hide_login"
android:layout_width ="1.0px"
android:layout_height ="wrap_content"
android:layout_weight ="2.0"
android:background ="@null"
android:drawableLeft="@drawable/checkbox"
android:button ="@null"
android:checked ="false"
android:drawablePadding ="4.0dip"
android:text = "隐身登陆"
android:textSize ="12.0sp" />
<CheckBox
android:id ="@+id/silence_login"
android:layout_width ="1.0px"
android:layout_height ="wrap_content"
android:drawableLeft="@drawable/checkbox"
android:layout_weight ="1.0"
android:background ="@null"
android:button ="@null"
android:checked ="false"
android:drawablePadding ="4.0dip"
android:text = "静音登录"
android:textSize ="12.0sp" />
</LinearLayout>
<LinearLayout
android:layout_width ="fill_parent"
android:layout_height ="wrap_content"
android:layout_marginBottom ="18.0dip"
android:layout_marginLeft ="30.0dip"
android:layout_marginRight ="30.0dip"
android:layout_marginTop ="18.0dip"
android:orientation ="horizontal" >
<CheckBox
android:id ="@+id/accept_accounts"
android:layout_width ="1.0px"
android:layout_height ="wrap_content"
android:drawableLeft="@drawable/checkbox"
android:layout_weight ="2.0"
android:background ="@null"
android:button ="@null"
android:checked ="true"
android:drawablePadding ="4.0dip"
android:singleLine ="true"
android:text = "允许手机/电脑同时在心线"
android:textSize ="12.0sp" />
<CheckBox
android:id ="@+id/accept_troopmsg"
android:layout_width ="1.0px"
android:layout_height ="wrap_content"
android:drawableLeft="@drawable/checkbox"
android:layout_weight ="1.0"
android:background ="@null"
android:button ="@null"
android:checked ="true"
android:drawablePadding ="4.0dip"
android:text = "接受群消息"
android:textSize ="12.0sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout >
</RelativeLayout>
登录界面对应的Activity:
public class LoginActivity extends Activity implements OnClickListener {
private Button login_Button;
private View moreHideBottomView, input2;
private ImageView more_imageView;
private boolean mShowBottom = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
}
private void initView() {
login_Button = (Button) findViewById(R.id.buton1);
login_Button.setOnClickListener(this);
moreHideBottomView = findViewById(R.id.morehidebottom);
more_imageView = (ImageView) findViewById(R.id.more_image);
input2 = findViewById(R.id.input2);
input2.setOnClickListener(this);
}
public void showBottom(boolean bShow) {
if (bShow) {
moreHideBottomView.setVisibility(View.GONE);
//more_imageView.setImageResource(R.drawable.login_more_up);
mShowBottom = true;
} else {
moreHideBottomView.setVisibility(View.VISIBLE);
//more_imageView.setImageResource(R.drawable.login_more);
mShowBottom = false;
}
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.input2:
showBottom(!mShowBottom);
break;
case R.id.buton1:
break;
default:
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//getMenuInflater().inflate(R.menu.activity_qq, menu);
return true;
}
}
分享到:
相关推荐
仿QQ客户端登录界面
android仿携程客户端界面实现。
android端和服务器端(struts2+hibernate)编写,客户端和服务器端分别实现分页,android端采用activitygroup实现,android端分页通过http协议访问oracle数据库 只在第二个界面编写分页,采用多线程编写,附数据库·...
粮情测控系统Android客户端界面的设计与实现.pdf
该项目用来练习Android布局和点击事件,适用初学者练手。无其他复杂功能,项目直接解压后导入即可运行。
新浪微博客户端启动界面实现,很实用的一个功能。
仿京东客户端界面效果~ 源码。 运行时请使用Google Api运行
本项目是一套基于安卓的京东商城高仿应用最新版项目源码,实现了首页、搜索页、商品分类页、购物页、个人中心的登录注册、应用设置页面的UI布局模仿。UI仿照度可以达到80%.翻了翻源码看了一下实现了摇一摇抽奖,...
本项目是一套基于安卓的京东商城高仿应用最新版项目源码,实现了首页、搜索页、商品分类页、购物页、个人中心的登录注册、应用设置页面的UI布局模仿。UI仿照度可以达到80%.翻了翻源码看了一下实现了摇一摇抽奖,...
去哪儿Android客户端首页和全部订单页分析和优化建议
从云音乐的apk弄的资源,模仿网易云音乐播放界面的实现源码。
仿照微信客户端,包括登陆 ,注册、聊天等,对于新手很有帮助,可以自由滑动,和真的微信主界面基本一样。
Android客户端插件人机界面指南.pdf
从这个星期开始,准备拿新浪微博开放平台做个实践,开发一个功能简单的android客户端,会尽可能的完善功能。 上图是这个客户端的主要界面。今天增加的功能。 1.简单的样式和皮肤,只是添加了按钮。 运行的系统是...
Android应用源码之仿赶集生活android客户端的介绍动画界面.zip
安卓Android源码——仿赶集生活android客户端的介绍动画界面.zip
安卓Android源码——仿赶集生活android客户端的介绍动画界面.rar
前面有写过一篇文章使用DrawerLayout实现Android仿网易客户端抽屉模式,昨天从群里看一哥们问抽屉式拖拉,从主界面的下方出现,而使用DrawerLayout实现的是覆盖掉主界面,今天我们就来实现一下主界面下方脱出菜单界面,...