Android仿qq登陆界面

每天登陆qq,就想着自己做一个qq登陆界面,下了一个qq.apk, 解压之后拿到里面的图片资源,就开始动工了。新建一个项目,将资源全部copy到自己的资源目录下!

尝试将自己qq数据清除,在登陆之前有一个彩色qq界面,这里写图片描述
这个界面只是停留两秒左右,所以`/**
* Created by Administrator on 2015/9/15.
*/
public class LoadActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            startActivity(new Intent(LoadActivity.this, MainActivity.class));
            finish();

        }
    },1000);


}

Handler handler = new Handler();

}`

发一个延时handler启动activity就可以了,然后将自身finish(),在这里引导页就没有做了。

在登陆界面的布局

<LinearLayout 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"
    android:background="#110080ff"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="#330080ff"

        android:orientation="vertical">

        <ImageView
            android:id="@+id/login_icon"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_gravity="center"
            android:layout_marginBottom="30dp"
            android:layout_marginTop="50dp"
            android:src="@mipmap/login_icon" />

    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <EditText
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#ffffffff"
            android:hint="QQ号/手机号/邮箱"
            android:paddingLeft="20dp"
            android:textColor="#ff000000"
            android:textSize="14sp" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#11000000" />

        <EditText
            android:id="@+id/password"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#ffffffff"
            android:hint="密码"
            android:paddingLeft="20dp"
            android:textColor="#ff000000"
            android:textSize="14sp" />


    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="center">

        <Button
            android:id="@+id/login_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:background="@drawable/shape"
            android:gravity="center"
            android:text="登 陆"
            android:textColor="#ffffffff"
            android:textSize="16sp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:gravity="bottom">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:id="@+id/non"
            android:text="无法登陆?" />

        <TextView
            android:id="@+id/news"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_gravity="bottom|right"
            android:gravity="left"
            android:text="新用户" />
    </LinearLayout>


</LinearLayout>

这里写图片描述

初始化`

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }
private void init(){
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.login_icon);
    loginIcon = (ImageView) findViewById(R.id.login_icon);
    loginIcon.setImageDrawable(new CircleImageDrawable(bitmap));
    mNon = (TextView)this.findViewById(R.id.non);
    mNon.setOnClickListener(this);
    mNews = (TextView)this.findViewById(R.id.news);
    mNews.setOnClickListener(this);
    mName = (EditText)this.findViewById(R.id.name);
    mPassWord = (EditText)this.findViewById(R.id.password);
    mName.addTextChangedListener(mNameTextWatcher);
    mPassWord.addTextChangedListener(mPasswordTextWatcher);

    mLoginButton = (Button)this.findViewById(R.id.login_button);
    mLoginButton.setOnClickListener(this);
}`

这样就可以了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值