導航:首頁 > 操作系統 > android45

android45

發布時間:2025-07-24 21:30:07

『壹』 如何設計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搜索圖標按鈕圖案在哪

android搜索銷拿圖標按鈕圖案在哪首先我們打開他的一個主茄猜程序的一個APP平台主頁面在他的一個菜單還有他的一個搜索圖標里虧納搭面我們就能找到一個圖案在他的一個菜單設置裡面我們可以看到圖案的在那裡

閱讀全文

與android45相關的資料

熱點內容
雲免費雲伺服器購買費用 瀏覽:538
級聯多模演算法 瀏覽:922
安卓系統如何設置數字簽名 瀏覽:466
dll存密碼防反編譯 瀏覽:442
醫學專業編程用什麼筆記本 瀏覽:938
廣州地鐵app為什麼無法開通 瀏覽:376
單片機模擬整流電路 瀏覽:341
搜狐雲伺服器的設置方法 瀏覽:502
程序員誰 瀏覽:715
怎麼把本地在密鑰導入伺服器上 瀏覽:73
蘋果筆記本文件夾白條 瀏覽:522
systemsav文件夾可以刪除嗎 瀏覽:900
串口伺服器怎樣改ip地址 瀏覽:770
當前伺服器正在維護中是什麼意思 瀏覽:774
樹莓派編寫代碼編譯 瀏覽:835
正負數統計編程 瀏覽:326
phigros安卓什麼時候出的 瀏覽:810
java列印素數 瀏覽:47
java對圖片加密 瀏覽:511
python中國象棋源程序組成 瀏覽:217