android内部培训视频_第五节(1)_OA实战之登录界面

第五节(1):OA实战之登录界面


 一、登录界面布局

1.背景图片

2.文本框

3.checkbox

4.按钮

暂未实现点击切换图片效果

<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"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:gravity="center"
    android:background="@drawable/login_bj"
    tools:context=".MainActivity" >

    <LinearLayout
        android:id="@+id/ll01"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/txtUserName"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:background="@drawable/input"
            android:layout_marginBottom="20dp"
            android:hint="@string/txtusername_tips"
            android:inputType="none" />

        <EditText
            android:id="@+id/txtPassword"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:background="@drawable/input"
            android:layout_marginBottom="20dp"
            android:hint="@string/txtpassword_tips"
            android:inputType="textPassword" />

        <LinearLayout
            android:id="@+id/ll02"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_horizontal"
            android:layout_marginBottom="20dp"
            >

            <CheckBox
                android:id="@+id/cbPass"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/cbpass_txt"
                />

            <CheckBox
                android:id="@+id/cbAuto"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/cbauto_txt"
                />

        </LinearLayout>

        <Button
            android:id="@+id/btnLogin"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:background="@drawable/login_btn"
            android:text="@string/btnlogin_txt"
            android:textSize="25sp"
            android:textColor="#FFF"
            />

    </LinearLayout>

</RelativeLayout>

android内部培训视频_第五节(1)_OA实战之登录界面

二、使用SharedPreferences记住用户名密码
SharedPreferences sharedPreferences = getSharedPreferences(
                "userinfo", MODE_PRIVATE);
        String userName = sharedPreferences.getString("userName", "");
        String userPass = sharedPreferences.getString("passWord", "");
        if(!"".equals(userName) && !"".equals(userPass)){
            txtUserName.setText(userName);
            txtPassword.setText(userPass);
        }
 
百度网盘视频下载地址:http://pan.baidu.com/s/1dDw2Rtf
上一篇:WEB浏览器与服务器通讯过程


下一篇:Powerdesigner 设置唯一约束