今天分享一下登陸界面用戶登錄名的檢測,大家都知道如果在服務(wù)器端進行所有用戶名的檢測是比較浪費資源的。用戶每點擊一次登陸就要發(fā)到服務(wù)端去檢測,對于服務(wù)端來說負荷是比較大的。所以呢在客服端對用戶的非法信息進行簡單的過濾是非常有必要的。

源碼下載:Android用戶名檢測
首先看一下效果:
當(dāng)輸入的用戶名大在合法區(qū)間則提示消失,如果密碼不為空則登陸按鈕可點擊
雖然功能很小卻用到了不少的東西:
接下來看一下源碼,為了是登陸界面更加美觀,我對登陸控件進行了圓形化處理,也就是開源醒目CircleImageView 項目主頁地址:https://github.com/hdodenhof/CircleImageView:
<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:orientation="vertical" android:background="@color/colorLogin" > <!-- Login progress --> <ProgressBar android:id="@+id/login_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:visibility="gone" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="180dp" android:id="@+id/head_img" > <de.hdodenhof.circleimageview.CircleImageView android:layout_width="80dp" android:layout_height="80dp" android:src="@mipmap/nav_head" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="25dp" /> </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="20dp" android:orientation="vertical"> <EditText android:id="@+id/et_user" android:layout_width="match_parent" android:layout_height="60dp" android:hint="@string/userName" android:background="@color/colorLoginForm" android:layout_marginBottom="5dp" /> <TextView android:id="@+id/tv_tip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/error" /> <EditText android:id="@+id/et_pass" android:layout_width="match_parent" android:layout_height="60dp" android:background="@color/colorLoginForm" android:hint="@string/passWord" android:paddingTop="1dp" /> </LinearLayout> <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="50dp" android:background="@color/loginButton" android:text="@string/loginButton" android:textColor="@color/colorLoginForm" /> </LinearLayout>
名稱欄目:Android登陸界面用戶名檢測功能-創(chuàng)新互聯(lián)
當(dāng)前網(wǎng)址:http://www.chinadenli.net/article30/djcdpo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、標(biāo)簽優(yōu)化、搜索引擎優(yōu)化、自適應(yīng)網(wǎng)站、微信小程序、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容