當前位置:首頁 » 安卓系統 » android登錄設計

android登錄設計

發布時間: 2022-11-26 12:53:28

A. android怎樣做簡單的登錄

Android開發工具裡面創建新app的時候可以創建一個用於登錄的activity界面,可以借鑒一下。

B. android 手機登錄界面layout怎麼設計

1 我們項目的前提是你已經將基本的運行環境及sdk都已經安裝好了,讀者可自行網路環境配置相關內容,本文不再贅述。右鍵點擊new-->Mole,Mole相當於新建了一個項目。如圖所示 2 選擇Android Application,點擊next 3 將My Mole 和app改成...

C. Android studio怎麼連接本地資料庫設計登錄界面

我們項目的前提是你已經將基本的運行環境及sdk都已經安裝好了,讀者可自行網路環境配置相關內容,本文不再贅述。右鍵點擊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有一個很強大的預覽功能,相當給力,將activity_main.xml的代碼替換成如下代碼:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:stretchColumns="0,3">
<TableRow>
<TextView />
<TextView
android:text="賬 號:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
/>
<EditText

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

一個登錄界面需要有:

  1. 登錄、注冊按鈕(Button)

  2. 用戶名、密碼輸入框(TextView,EditView)

  3. 用戶協議連接

  4. 忘記密碼按鈕


想好的有哪些控制項後,開始設計界面大概樣式,比如這個樣子:

安卓登錄界面就寫完了。

E. 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>

F. 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、實現效果如下:

G. 如何使用android studio開發用戶登錄界面

使用AndroidStudio開發用戶登錄界面是可以直接創建的,創建步驟如下。1、點擊菜單欄的「File」-->"New"-->「NewProject」。2、然後輸入創建的項目名-->點擊"next",。3、然後點擊"Next",選擇創建登錄界面。4.然後點擊"Fisih"5、項目創建完成

H. Android studio相對布局怎麼設計一個登陸界面

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55ffff">

<TextView
android:id="@+id/tv_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:padding="10dp"
android:background="#ffffff"
android:hint="密碼"
android:textSize="15sp"
android:textColor="#000000"
android:layout_centerInParent="true"/>


<TextView
android:id="@+id/tv_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#ffffff"
android:padding="10dp"
android:hint="用戶名"
android:textSize="15sp"
android:layout_marginBottom="15dp"
android:textColor="#000000"
android:layout_above="@+id/tv_password"/>

<TextView
android:id="@+id/tv_forget_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_password"
android:layout_alignLeft="@+id/tv_password"
android:paddingTop="10dp"
android:text="忘記密碼>"
android:textSize="14sp"
android:textColor="#ff0000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_password"
android:layout_alignRight="@+id/tv_password"
android:paddingTop="10dp"
android:text="注冊>"
android:textSize="14sp"
android:textColor="#ff0000" />

<Button
android:id="@+id/but_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="20dp"
android:background="#4169E1"
android:text="登錄"
android:textSize="18sp"
android:textColor="#ffffff"
android:layout_below="@+id/tv_forget_password"/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_launcher"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:layout_above="@+id/tv_user"/>
</RelativeLayout>

I. App登錄界面----布局篇

       我自學了3個月的Android基礎,居然一個App都做不出來。在我之前學的同時居然忘記了之前學的內容。所以我現在重新開始復習,這篇文章將是我復習的開始也是基礎的穩固,同時也是將來記不得了可以自我回顧的筆記。首先是從App登錄開始。

       首先第一是布局,登錄界面布局那就要用到控制項,登錄界面所需控制項如下:

1.姓名     輸入框   密碼 輸入框:就要有Textview文本控制項 X 2, Editview輸入文本框控制項 X 2

2.立即注冊  忘記密碼 登錄 :就要有Button控制項 X 3

既然要布局就要有布局控制項:可以用RelativeLayout相對布局,LinearLayout線性布局,TableLayout表格布局,FrameLayout幀布局,AbsoluteLayout絕對布局。我要選用就就是前兩個布局:RelativeLayout相對布局或者LinearLayout線性布局。

這就是我最終預想所要達到的效果:

首先打開布局文件:展開app--->res--->layout--->activity_main.xml

切換到設計模式Design:

然後從調色板Palette就是控制項庫拖拽出所需控制項:

2個Textview,2個Editview ,3個Button.一開始布局控制項就是相對布局控制項,RelativeLayout相對布局控制項允許通過指定顯示對象相對於父容器或其他兄弟控制項的相對位置結合margin,padding來進行布局。

然後我們再切換迴文本模式Text:

<TextView

android:text="TextView"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

/>這就組成了一個控制項。

再來解釋解釋RelativeLayout相對布局控制項是啥意思:

上圖所表現的意思就是RelativeLayout相對布局控制項的特點:TextView文本控制項基於父容器(RelativeLayout相對布局控制項)之下,再看圖:

它會自動添加默認屬性:android:text="文本控制項"//這是文本屬性可以輸入文字

android:textSize="50dp"//這是文本大小屬性是控制text屬性的大小

android:layout_width="wrap_content"//這是寬,選擇的自適應屏幕

android:layout_height="wrap_content"這是高。

android:layout_marginTop="253dp"// 重點就在這里了:在RelativeLayout相對布局下拖出的控制項會有這條屬性,意思是TextView相距父容器253dp的距離

android:id="@+id/textView"

android:layout_alignParentTop="true"

android:layout_centerHorizontal="true"

好了我們繼續:我寫的這個布局呢?只用了兩個EditView控制項和三個Button控制項。先說EditView控制項。

拖拽出來改好了各種屬性但是和我的不一樣,哪裡不一樣?有邊框,邊框還是圓角。怎麼弄的?這是改變了它的樣式。首先目錄找到drawable文件按下Alt+lns鍵,點擊Drawable resource file

那就會彈出下面這個框框好創建資源文件,File name:這是資源文件的名字,Root element:這是需要創建什麼類型的資源文件。

假如沒有出現這個對話框而是另外的對話框就請更換模式

將Android 目錄模式切換成Project目錄模式

找到drawable文件重復上面操作就會出現

名字就自己取吧,類型選擇shape文件

這就是我為EditView設置的資源文件,那麼怎麼載入它呢?

用背景background屬性來載入:@drawable/border用@選擇文件位置載入就成功了。

文本框就做好了。噢!!!等等還有個屬性android:hint="登錄"還沒介紹,這是提示語:比如請輸入用戶名,請輸入密碼,這樣的提示語,只起到提示作用。範例:android:hint="請輸入用戶名"

好吧依次類推,Button按鈕也是這樣。我們先來看忘記密碼,立即注冊兩控制項這兩我沒這樣載入資源文件,我只用了3條屬性,

android:background="@null"//這條意思是背景設置路徑為空,作用是消除邊框。

android:shadowColor="#338AFF"//改變按鈕背景顏色,讓它看起來和相對布局背景融為一體。

android:textColor="#0066CC"//改變文字顏色

怎麼樣是不是和QQ登錄界面的差不多

那再來看立即登錄按鈕,這個按鈕我用了三個資源文件,為了讓按鈕按下抬起有一個變色效果,能夠反饋用戶視覺:您已按下按鈕。

首先看按下的資源文件:

這是按下的模樣,radius是設置圓角,然後是按下後的顏色。

再來看抬起:

這是抬起時候的樣子,圓角按下抬起都要設置一樣,不然按下是一個樣,抬起又是另一個樣子,然後是抬起的顏色。

這是兩個資源文件,如何讓按鈕呈現出按下抬起的不同效果呢?

就需要另一個資源文件來操控:selector資源文件

由他來控制這兩個資源文件:

<item/>這是資源文件的標簽,包括shape資源文件的:<corners/><solid/>都是標簽

標簽<item/>裡面

android:drawable="@drawable/clickroundedcolor"//是載入按下資源文件,

android:state_pressed="true"//true就是對,就是一個判斷作用,判斷是否按下,按下就載入按下的資源文件

然後再一個子標簽<item/>

<item android:drawable="@drawable/roundedcolor"/>也就是說當上面pressed不為true的時候執行下面這個標簽載入抬起狀態的效果。

這就做成了按下深藍抬起淺藍的顏色效果。那今天就到這里,復習到了什麼Editview Button控制項的使用然後在原來的基礎上學到了EditView 和Button控制項的UI設計一些細節效果。

還熟悉了Android studio。之前用Eclipse學習的Android,現在改用AS還特別不習慣,希望復習後我會熟練Android studio。恩,還有看到忘記密碼,立即注冊兩個按鈕是不是還會聯想到還有兩個布局。沒錯,忘記密碼和立即注冊這兩個布局文件,就不用記錄了,相信會了登錄主界面布局,其他兩個不在話下。

J. 如何用android製作用戶登錄程序

方法/步驟
我們項目的前提是你已經將基本的運行環境及sdk都已經安裝好了,讀者可自行網路環境配置相關內容,本文不再贅述。右鍵點擊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有一個很強大的預覽功能,相當給力

我們將activity_main.xml的代碼替換成如下代碼:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:stretchColumns="0,3">
<TableRow>
<TextView />
<TextView
android:text="賬 號:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
/>
<EditText
android:id="@+id/account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
android:minWidth="220px"/>
<TextView />
</TableRow>
<TableRow android:layout_marginTop="20px">
<TextView />
<TextView
android:text="密 碼:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

/>
<EditText
android:id="@+id/pwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="220px"
android:textSize="24px"
android:inputType="textPassword"/>
<TextView />
</TableRow>
<TableRow android:layout_marginTop="20px">
<TextView />
<Button
android:id="@+id/login"
android:text="登錄"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/quit"
android:text="退出"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView />
</TableRow>
</TableLayout>

使用Android 手機進行測試,大功告成

注意事項

一定要先配置好java運行環境及android運行環境
跟著步驟操作

熱點內容
離線語音識別android 發布:2025-05-20 08:11:37 瀏覽:152
小鳥雲如何去看客戶伺服器密碼 發布:2025-05-20 07:58:51 瀏覽:898
怎麼更改app的密碼 發布:2025-05-20 07:54:32 瀏覽:784
汽車配置物品怎麼處理 發布:2025-05-20 07:47:23 瀏覽:225
怎麼修改華為wifi密碼 發布:2025-05-20 07:45:12 瀏覽:41
php函數遞歸 發布:2025-05-20 07:39:36 瀏覽:781
登陸認證失敗請檢查伺服器地址 發布:2025-05-20 07:06:55 瀏覽:831
無限分類實現php 發布:2025-05-20 06:57:40 瀏覽:681
數據結構c語言版嚴蔚敏李冬梅 發布:2025-05-20 06:55:05 瀏覽:449
iphone快捷訪問 發布:2025-05-20 06:55:05 瀏覽:929