導航:首頁 > 操作系統 > android登陸界面

android登陸界面

發布時間:2022-01-13 07:30:04

㈠ 如何設計android的登錄界面

在網上在到一個登錄界面感覺挺不錯的,給大家分享一下~先看效果圖:

這個Demo除了按鈕、小貓和Logo是圖片素材之外,其餘的UI都是通過代碼實現的。

?

一、背景

背景藍色漸變,是通過一個xml文件來設置的。代碼如下:

background_login.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:andro>
<gradient
android:startColor="#FFACDAE5"
android:endColor="#FF72CAE1"
android:angle="45"
/>
</shape>


startColor是漸變開始的顏色值,endColor是漸變結束的顏色值,angle是漸變的角度。其中#FFACDAE5中,FF是Alpha值,AC是RGB的R值,DA是RGB的G值,E5是RGB的B值,每個值在00~FF取值,即透明度、紅、綠、藍有0~255的分值,像要設置具體的顏色,可以在PS上的取色器上查看設置。

?

?

二、圓角白框

效果圖上面的並不是白框,其實框是白色的,只是設置了透明值,也是靠一個xml文件實現的。

background_login_div.xml

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:andro>
<solid android:color="#55FFFFFF" />
<!-- 設置圓角
注意: bottomRightRadius是左下角而不是右下角 bottomLeftRadius右下角-->
<corners android:topLeftRadius="10dp" android:topRightRadius="10dp"
android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp"/>
</shape>

?

三、界面的布局

界面的布局挺簡單的,就直接貼代碼啦~

login.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:andro
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background_login">
<!-- padding 內邊距 layout_margin 外邊距
android:layout_alignParentTop 布局的位置是否處於頂部 -->

<RelativeLayout
android:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="15dip"
android:layout_margin="15dip"
android:background="@drawable/background_login_div_bg" >
<!-- 賬號 -->
<TextView
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:text="@string/login_label_username"
/>
<EditText
android:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/login_username_hint"
android:layout_below="@id/login_user_input"
android:singleLine="true"
android:inputType="text"/>
<!-- 密碼 text -->
<TextView
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/username_edit"
android:layout_marginTop="3dp"
android:text="@string/login_label_password"
/>
<EditText
android:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/login_password_input"
android:password="true"
android:singleLine="true"
android:inputType="textPassword" />
<!-- 登錄button -->
<Button
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/password_edit"
android:layout_alignRight="@id/password_edit"
android:text="@string/login_label_signin"
android:background="@drawable/blue_button" />
</RelativeLayout>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView android:
android:text="@string/login_register_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:textColor="#888"
android:textColorLink="#FF0066CC" />
<ImageView android:
android:src="@drawable/cat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="25dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="25dp" />
<ImageView android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/miniTwitter_logo"
android:layout_alignBottom="@id/miniTwitter_logo"
android:paddingBottom="8dp"/>
</RelativeLayout>
</LinearLayout>

㈡ 開發Android 怎樣實現登錄界面的跳轉 詳細

intent跳轉有兩種方式,一種是我們常用的顯示跳轉,還有一種是隱式跳轉。
顯式方式:Intent aIntent = new Intent(this,XXActivity.class);第一個是你當前Activity的對象,第一個參數是你要跳轉Activity的類。這種方式適合在同一個APP中的內部跳轉。
隱式方式:Intent aIntent = new Intent("actiionXXXXXXX"),參數為你在AndroidManifest.xml中配置的Actitiy中<intent-filter><action android:name="actionXXXXXXXX"/><intent-filter>

㈢ android項目未登陸的時候進入登陸界面 登陸的話下一次進來就直接跳到主界面怎麼實現

用SharedPreferences來保存當前用戶的信息和登錄成功的狀態

前者是保證你後續的界面能正常調用數據。
後者是判斷此用戶是否已經登錄過一次。

註:保存當前用戶的信息一般保存ID

㈣ android怎麼做動態的登陸界面

設計android的登錄界面的方法:

UI實現的代碼如下:

1、背景設置圖片:

background_login.xml

<?xmlversion="1.0"encoding="utf-8"?>

<shapexmlns:android="http://schemas.android.com/apk/res/android">

<gradient

android:startColor="#FFACDAE5"

android:endColor="#FF72CAE1"

android:angle="45"

/>

</shape>

2、圓角白框

效果圖上面的並不是白框,其實框是白色的,只是設置了透明值,也是靠一個xml文件實現的。

background_login_div.xml

<?xmlversion="1.0"encoding="UTF-8"?>

<shapexmlns:android="http://schemas.android.com/apk/res/android">

<solidandroid:color="#55FFFFFF"/>

<!--設置圓角

注意:bottomRightRadius是左下角而不是右下角bottomLeftRadius右下角-->

<cornersandroid:topLeftRadius="10dp"android:topRightRadius="10dp"

android:bottomRightRadius="10dp"android:bottomLeftRadius="10dp"/>

</shape>


3、界面布局:

login.xml

<?xmlversion="1.0"encoding="utf-8"?>

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="@drawable/background_login">

<!--padding內邊距layout_margin外邊距

android:layout_alignParentTop布局的位置是否處於頂部-->

<RelativeLayout

android:id="@+id/login_div"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:padding="15dip"

android:layout_margin="15dip"

android:background="@drawable/background_login_div_bg">

<!--賬號-->

<TextView

android:id="@+id/login_user_input"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentTop="true"

android:layout_marginTop="5dp"

android:text="@string/login_label_username"

style="@style/normalText"/>

<EditText

android:id="@+id/username_edit"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:hint="@string/login_username_hint"

android:layout_below="@id/login_user_input"

android:singleLine="true"

android:inputType="text"/>

<!--密碼text-->

<TextView

android:id="@+id/login_password_input"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/username_edit"

android:layout_marginTop="3dp"

android:text="@string/login_label_password"

style="@style/normalText"/>

<EditText

android:id="@+id/password_edit"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_below="@id/login_password_input"

android:password="true"

android:singleLine="true"

android:inputType="textPassword"/>

<!--登錄button-->

<Button

android:id="@+id/signin_button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/password_edit"

android:layout_alignRight="@id/password_edit"

android:text="@string/login_label_signin"

android:background="@drawable/blue_button"/>

</RelativeLayout>

<RelativeLayout

android:layout_width="fill_parent"

android:layout_height="wrap_content">

<TextViewandroid:id="@+id/register_link"

android:text="@string/login_register_link"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="15dp"

android:textColor="#888"

android:textColorLink="#FF0066CC"/>

<ImageViewandroid:id="@+id/miniTwitter_logo"

android:src="@drawable/cat"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentRight="true"

android:layout_alignParentBottom="true"

android:layout_marginRight="25dp"

android:layout_marginLeft="10dp"

android:layout_marginBottom="25dp"/>

<ImageViewandroid:src="@drawable/logo"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_toLeftOf="@id/miniTwitter_logo"

android:layout_alignBottom="@id/miniTwitter_logo"

android:paddingBottom="8dp"/>

</RelativeLayout>

</LinearLayout>

4、java源代碼,Java源文件比較簡單,只是實例化Activity,去掉標題欄。

packagecom.mytwitter.acitivity;

importandroid.app.Activity;

importandroid.os.Bundle;

importandroid.view.Window;

{

@Override

publicvoidonCreate(BundlesavedInstanceState){

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView(R.layout.login);

}

}

5、實現效果如下:

㈤ 如何實現android程序第一次登陸時顯示初始界面

SharedPreferences存儲一個boolean值,在onCreate()方法中判斷這個boolean值,如果為true就顯示初始化界面,顯示初始化界面之後將存儲到SharedPreferences的boolean值設置為false,這樣在下次進入到這個activity的時候,由於將boolean值置為false了,就不會初始化那個界面了。

㈥ 怎麼用android寫一個登入界面

在res文件夾下的zdlayout文件夾下創建文件為「文件名.xml」
然後編寫代碼或直接專拖動需要的控制項到界面上
在啟動Activity的onCreate方法中寫一句代碼「setContentView(R.layout.文件名);」,如果已存在則屬替換之

㈦ 如何使用Android Studio開發用戶登錄界面

右鍵點擊new-->Mole,Mole相當於新建了一個項目。

選擇Android Application,點擊next
將My Mole 和app改成自己項目相應的名字,同時選擇支持的Android版本
這一步選擇Blank Activity,自己手動編寫登錄界面,而不依賴系統內置的Login Activity,一直點擊next,最後點擊finish就完成了項目的創建
在project下可以看到出現了剛才創建的login項目
展開res/layout,點擊打開activity_main.xml文件,在這個文件里將完成登錄界面的編寫。
這是初始的主界面,還沒有經過編寫的界面,Android Studio有一個很強大的預覽功能,相當給力,接下來編寫代碼。

㈧ android登錄界面設計輸入框用什麼控制項

這個是EditText,用2個控制項 屬性裡面加 android:hint="用戶名" ,分割線的效果 我想是背景圖片造成的

㈨ android開發登錄界面怎麼寫

如果上圖所示,就是簡單的登錄界面了。andord的布局真的是,真的是,哪個。難以掌握的東西,哈,不過一旦了解深入點,又讓人爽的不行,流式布局總是比起windows mobile的絕對布局簡單而且容易控制。我是越來越傾向於流式布局的方式了,它的一點好處是適應設備時比較靈巧,wm使用了自適應dpi的方式,哪叫一個復雜啊,切不易於控制。

布局的屬性 android:layout_width="fill_parent" ,指示了填充父區域,就是父容器有多大空間,就填充多大空間。android:layout_width="wrap_content",指示了它本身需要多大空間,就像父容器索取多大的空間,怎麼說呢,就是它有多胖就佔多大空。而哪個fill_parent就是不胖也全占滿了。
再說android:layout_weight="0.1",這個weight(重量)是個很有意思的東西。可為一個父容器的 「子控制項們」設置這個重量屬性,父容器根據這個重量的多少擇情分給這些子控制項們多大空間。同時這個屬性還與子控制項 寬高屬性的顯示(fill_parent 或者wrap_content)模式有關。

代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/images1"
>

<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_weight="0.9"
android:layout_height="fill_parent">
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/LinearLayout02"
android:layout_weight="0.1"
android:orientation="vertical"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/LinearLayout03" android:layout_width="wrap_content" android:layout_height="wrap_content"></LinearLayout>
<LinearLayout
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:gravity="center"
android:layout_width="fill_parent"
android:id="@+id/LinearLayout_account"
android:orientation="horizontal"
android:layout_height="wrap_content">

<TextView android:textSize="12pt" android:id="@+id/lblAccount"
android:text="@string/accountName"
android:layout_weight="0.75"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TextView>

<EditText
android:layout_weight="0.25"
android:layout_width="fill_parent"
android:text="mailto:%22&nbsp;%20android:id=%22@+id/editBoxAccount" android:layout_height="wrap_content"></EditText>

</LinearLayout>

<LinearLayout
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:gravity="center"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">

<TextView android:textSize="12pt" android:id="@+id/lblPassword"
android:text="@string/password"
android:layout_weight="0.75"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TextView>

<EditText
android:layout_weight="0.25"
android:layout_width="fill_parent"
android:password="true"
android:text="mailto:%22&nbsp;%20android:id=%22@+id/editBoxPassword" android:layout_height="wrap_content"></EditText>

</LinearLayout>

<LinearLayout
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:gravity="center"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">

<Button android:text="登錄"
android:textSize="9pt"

android:id="@+id/btnLogin" android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>

</LinearLayout>
</LinearLayout>
</LinearLayout>

㈩ 急求用eclipse做的android application!!(登錄界面的(login))

http://www.eoeandroid.com/thread-225709-1-1.html
你看看這個把,認真看一下。照著自己寫寫,對你有幫助!如果不懂在回復我!希望能夠幫助你

閱讀全文

與android登陸界面相關的資料

熱點內容
求知課堂python2020 瀏覽:260
kafka刪除topic命令 瀏覽:759
phpsql單引號 瀏覽:86
英雄聯盟壓縮壁紙 瀏覽:452
辦公app需要什麼伺服器 瀏覽:628
安卓伺服器怎麼獲得 瀏覽:808
空調壓縮機冷媒的作用 瀏覽:781
淘寶app是以什麼為利的 瀏覽:657
java提取圖片文字 瀏覽:924
我的世界手機版指令復制命令 瀏覽:35
java判斷字元串為數字 瀏覽:926
androidrpc框架 瀏覽:490
雲伺服器essd和ssd 瀏覽:524
家用網關的加密方式 瀏覽:3
怎麼從ppt導出pdf文件 瀏覽:973
換汽車空調壓縮機軸承 瀏覽:845
平板怎麼登錄安卓端 瀏覽:197
圖像拼接計演算法 瀏覽:257
怎麼打開飢荒伺服器的本地文件夾 瀏覽:293
usb掃描槍編程 瀏覽:675