導航:首頁 > 編程語言 > android歡迎界面代碼

android歡迎界面代碼

發布時間:2024-04-11 20:02:20

⑴ 如何設計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歡迎界面有如下幾個特點:
第一次打開微信時, 會彈出歡迎界內面(歡迎界面+延遲載入微信主容界面), 之後在打開則不會有該界面彈出
強殺進程 或者 清除最近運行列表, 下次運行時, 則又會彈出歡迎界面
目測上述實現效果, 個人推測可能的實現方法是:
有可能利用了Task & Back Stack 的特性
有可能歡迎界面只是一個單純的View

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

一個登錄界面需要有:

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

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

  3. 用戶協議連接

  4. 忘記密碼按鈕


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

安卓登錄界面就寫完了。

閱讀全文

與android歡迎界面代碼相關的資料

熱點內容
農業大數據雲計算 瀏覽:124
不用升級的角色游戲 瀏覽:919
大數據比對是什麼內容 瀏覽:617
華為分享照片存儲在哪個文件 瀏覽:296
windows7正在還原以前版本 瀏覽:738
醫學編程哪個好學 瀏覽:354
substancejar教程 瀏覽:760
網路游戲網站源碼 瀏覽:682
wordpress儀表盤登陸 瀏覽:454
ps文件很小是怎麼回事 瀏覽:124
蘋果文件丟失用什麼軟體找回便宜 瀏覽:148
大數據如何為政府服務 瀏覽:360
三星i9308怎麼升級 瀏覽:152
有哪些好的設計網站發布作品 瀏覽:964
miui7系統自帶app下載 瀏覽:61
做數據分析需要具備什麼 瀏覽:585
學通訊和編程哪個難 瀏覽:905
word背景保存 瀏覽:216
電腦里的文件怎麼判斷是否有用 瀏覽:324
小米4禁止後台程序 瀏覽:268

友情鏈接