當前位置:首頁 » 安卓系統 » android登陸布局

android登陸布局

發布時間: 2022-11-22 02:42:34

A. android 界面布局實現

1、最外面用線性布局,屬性為垂直,margin TOP屬性設置為10px,在這個布局包括了下面的2、3、4、5、6幾個布局
2、日常選項為TextView,
3、時間用線性布局屬性為水平,margin right屬性設置為10px,同時添加背景圖片屬性,裡面在放兩個TextView分別是時間和2011-10-06 11:04,包含在時間的線性布局中
4、賬戶用線性布局屬性為水平,margin right屬性設置為10px,同時添加背景圖片屬性,裡面在放兩個TextView分別是賬戶和現金,包含在時間的賬戶的線性布局中
5、商家地點用線性布局屬性為水平,margin right屬性設置為10px,同時添加背景圖片屬性,裡面在放兩個TextView分別是商家地點和未指定,包含在商家/地點的線性布局中
6、備注用線性布局屬性為水平,margin right屬性設置為10px,同時添加背景圖片屬性,裡面放一個TextView是備注
這樣就可以做出來了
還不明白的話在給我留言吧~我把大概的代碼寫給你看~

B. android登陸界面用什麼布局好

布局無所謂,相對布局,線性布局都行,還可以自定義布局.

C. android登陸界面用哪個布局好

整理思路:
1、控制項:文字TextView 和 右箭頭ImageView
2、因為考慮到點擊效果,設計為:最外層為全圓角,內層有四種情況,分別為上圓角、無圓角、下圓角和全圓角。
3、內層樣式效果:需要初始樣式、和點擊樣式
4、需要知識:結合style、shake、selector組合樣式
布局:
布局文件
樣式:
layout樣式
控制項樣式
點擊樣式和默認樣式

其中舉例上圓角的背景設置為:
top_layout_selector.xml
top_select.xml

D. 如何設計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>

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

F. Android如何實現類似於QQ登錄的界面,求大神!

首先程序進入SplashActivity,就是啟動頁面。
xml布局文件就是一個全屏的圖片,要注意的是設置android:scaleType ="matrix"這個屬性。不然不會全屏。
過1秒之後轉入登陸頁面,從圖片我們可以看出,騰訊的UI做的還是相當美觀漂亮的,既簡潔又不失美觀。先分析一下這個登錄界面,從整體可以看出,根布局的
背景色是藍色的,而那個QQ Android其實是一個圖片背景色和根布局的背景色一樣,這樣就不會有視覺偏差。

G. 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。恩,還有看到忘記密碼,立即注冊兩個按鈕是不是還會聯想到還有兩個布局。沒錯,忘記密碼和立即注冊這兩個布局文件,就不用記錄了,相信會了登錄主界面布局,其他兩個不在話下。

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

I. android登陸界面該怎麼寫啊

android new activity的時候就有示例可以選擇,google有現成的登錄界面布局可以選擇。

J. android studio做酷狗登錄界面

android studio做酷狗登錄界面如下
使用Android Studio 編寫的第一個demo,使用布局文件—xml實現用戶登錄界面
註:所建工程均為Android 6.0 所以只要是Android 6.0(包括6.0)以上的真機,模擬機都可以使用
Step1:Android Studio 開發環境的搭建:
1.安裝JDK (1.8);
2.安裝Android studio (3.3.1) 包含 gradle、sdk manage 、avd manage ;
3.使用sdk manage 下載安裝 sdk;
4.使用avd manages 創建虛擬機。

熱點內容
陰陽師按鍵腳本 發布:2024-05-05 12:00:33 瀏覽:758
魔獸查腳本 發布:2024-05-05 11:54:37 瀏覽:38
sqlserver執行時間 發布:2024-05-05 11:50:31 瀏覽:648
終端配置賬號該如何改密碼 發布:2024-05-05 11:24:37 瀏覽:825
成都存儲研發招聘 發布:2024-05-05 11:24:29 瀏覽:285
電腦伺服器名稱怎麼查找 發布:2024-05-05 10:49:37 瀏覽:470
電腦連到代理伺服器 發布:2024-05-05 10:40:02 瀏覽:250
華為安卓手機如何投屏到雷克薩斯 發布:2024-05-05 10:37:50 瀏覽:211
微博上傳原圖 發布:2024-05-05 10:20:05 瀏覽:749
伺服器換電腦需要什麼東西 發布:2024-05-05 09:52:28 瀏覽:754