Android實(shí)現(xiàn)簡(jiǎn)單QQ登錄頁(yè)面
Android開(kāi)發(fā)實(shí)現(xiàn)極為簡(jiǎn)單的QQ登錄頁(yè)面,供大家參考,具體內(nèi)容如下
設(shè)計(jì)一個(gè)簡(jiǎn)單QQ登錄頁(yè)面,無(wú)任何功能。然后打包安裝到手機(jī)。
1.首先創(chuàng)建一個(gè)空白頁(yè)面


2.打開(kāi)樣式設(shè)計(jì)的頁(yè)面

在activity_main.xml中寫(xiě)入代碼
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" ? ? xmlns:app="http://schemas.android.com/apk/res-auto" ? ? xmlns:tools="http://schemas.android.com/tools" ? ? android:layout_width="match_parent" ? ? android:layout_height="match_parent" ? ? android:background="#E6E6E6"http://改背景色 ? ? tools:context=".MainActivity"> ? ? <RelativeLayout android:layout_width="match_parent"http://相對(duì)布局 ? ? ? ? android:layout_height="match_parent" ? ? ? ? android:layout_marginTop="60dp"http://距頂部距離 ? ? ? ? android:background="#E6E6E6"http://改背景色 ? ? ? ? android:orientation="vertical"> ? ? <ImageView//放圖片 ? ? ? ? android:id="@+id/iv" ? ? ? ? android:layout_width="70dp" ? ? ? ? android:layout_height="70dp" ? ? ? ? android:layout_centerHorizontal="true"http://居中 ? ? ? ? android:layout_marginTop="40dp" ? ? ? ? android:background="@drawable/head"/>//圖片的位置 ? ? <LinearLayout//線性布局 ? ? ? ? android:id="@+id/ll_number" ? ? ? ? android:layout_width="match_parent" ? ? ? ? android:layout_height="wrap_content" ? ? ? ? android:layout_below="@id/iv"http://在imageview下面 ? ? ? ? android:layout_centerVertical="true"http://居中 ? ? ? ? android:layout_marginBottom="5dp" ? ? ? ? android:layout_marginLeft="10dp" ? ? ? ? android:layout_marginRight="10dp" ? ? ? ? android:layout_marginTop="15dp" ? ? ? ? android:background="#ffffff"> ? ? ? ? <TextView//顯示文本 ? ? ? ? ? ? android:id="@+id/tv_number" ? ? ? ? ? ? android:layout_width="wrap_content" ? ? ? ? ? ? android:layout_height="wrap_content" ? ? ? ? ? ? android:padding="10dp" ? ? ? ? ? ? android:text="賬號(hào):" ? ? ? ? ? ? android:textColor="#000" ? ? ? ? ? ? android:textSize="20sp"/> ? ? ? ? <EditText//輸入框 ? ? ? ? ? ? android:id="@+id/et_number" ? ? ? ? ? ? android:layout_width="match_parent" ? ? ? ? ? ? android:layout_height="wrap_content" ? ? ? ? ? ? android:layout_marginLeft="5dp" ? ? ? ? ? ? android:background="@null" ? ? ? ? ? ? android:padding="10dp"/> ? ? </LinearLayout> ? ? <LinearLayout ? ? ? ? android:id="@+id/ll_password" ? ? ? ? android:layout_width="match_parent" ? ? ? ? android:layout_height="wrap_content" ? ? ? ? android:layout_below="@id/ll_number" ? ? ? ? android:layout_centerVertical="true" ? ? ? ? android:layout_marginLeft="10dp" ? ? ? ? android:layout_marginRight="10dp" ? ? ? ? android:background="#ffffff"> ? ? ? ? <TextView ? ? ? ? ? ? android:id="@+id/tv_password" ? ? ? ? ? ? android:layout_width="wrap_content" ? ? ? ? ? ? android:layout_height="wrap_content" ? ? ? ? ? ? android:padding="10dp" ? ? ? ? ? ? android:text="密碼:" ? ? ? ? ? ? android:textColor="#000" ? ? ? ? ? ? android:textSize="20sp"/> ? ? ? ? <EditText ? ? ? ? ? ? android:id="@+id/et_password" ? ? ? ? ? ? android:layout_width="match_parent" ? ? ? ? ? ? android:layout_height="wrap_content" ? ? ? ? ? ? android:layout_marginLeft="5dp" ? ? ? ? ? ? android:layout_toRightOf="@id/tv_password" ? ? ? ? ? ? android:background="@null" ? ? ? ? ? ? android:inputType="textPassword"http://密文顯示 ? ? ? ? ? ? android:padding="10dp"/> ? ? </LinearLayout> ? ? <Button//登錄按鈕 ? ? ? ? android:id="@+id/btn_login" ? ? ? ? android:layout_width="match_parent" ? ? ? ? android:layout_height="wrap_content" ? ? ? ? android:layout_below="@id/ll_password" ? ? ? ? android:layout_marginLeft="10dp" ? ? ? ? android:layout_marginRight="10dp" ? ? ? ? android:layout_marginTop="50dp" ? ? ? ? android:background="#3C8DC4" ? ? ? ? android:text="登錄" ? ? ? ? android:textColor="#ffffff" ? ? ? ? android:textSize="20sp"/> ? ? </RelativeLayout> </androidx.constraintlayout.widget.ConstraintLayout>
在虛擬機(jī)里跑一下

效果還算可以吧
試試能不能打包一下,安裝到手機(jī)上。





報(bào)錯(cuò)了…

網(wǎng)上查了一下解決辦法。在build.gradle文件里添點(diǎn)代碼:
lintOptions {
? ? ? ? checkReleaseBuilds false
? ? ? ? abortOnError false
? ? }
成功了。

挺不錯(cuò)

參考圖書(shū)《Android移動(dòng)開(kāi)發(fā)基礎(chǔ)案例教程》
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Android Studio實(shí)現(xiàn)注冊(cè)頁(yè)面跳轉(zhuǎn)登錄頁(yè)面的創(chuàng)建
- android實(shí)現(xiàn)注冊(cè)登錄程序
- 在Android環(huán)境下WebView中攔截所有請(qǐng)求并替換URL示例詳解
- Android WebView通過(guò)動(dòng)態(tài)的修改js去攔截post請(qǐng)求參數(shù)實(shí)例
- Android實(shí)現(xiàn)WebView點(diǎn)擊攔截跳轉(zhuǎn)原生
- Android基于方法池與回調(diào)實(shí)現(xiàn)登錄攔截的場(chǎng)景
相關(guān)文章
如果你在Android Studio碰到gradle的各種問(wèn)題就來(lái)看這篇文章吧(強(qiáng)烈建議收藏)
這篇文章主要介紹了你可能會(huì)在Android Studio碰到gradle的各種問(wèn)題,完美解決關(guān)于gradle的全部問(wèn)題,切記收藏以防需要的時(shí)候找不到了哦2021-08-08
Android錄音--AudioRecord、MediaRecorder的使用
本篇文章主要介紹了Android錄音--AudioRecord、MediaRecorder的使用,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02
Android入門之Glide顯示網(wǎng)絡(luò)圖片高版本的使用詳解
這篇文章主要為大家詳細(xì)介紹了Android中Glide顯示網(wǎng)絡(luò)圖片高版本的使用方法,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解一下2023-02-02
Android使用listview實(shí)現(xiàn)分頁(yè)刷新(線程休眠模擬)
這篇文章主要為大家詳細(xì)介紹了Android使用listview實(shí)現(xiàn)分頁(yè)刷新,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-11-11
Android簡(jiǎn)單實(shí)用的可拖拽GridView組件分享
在我們?nèi)粘i_(kāi)發(fā)中,使用?GridView?這種網(wǎng)格視圖的場(chǎng)合還是不少的,本篇我們來(lái)介紹一個(gè)支持拖拽的?GridView?組件,可以輕松搞定網(wǎng)格視圖的拖拽排序,需要的可以參考一下2023-06-06
解決Android Studio Gradle Metadata特別慢的問(wèn)題
這篇文章主要介紹了解決Android Studio Gradle Metadata特別慢的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-03-03

