欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實現(xiàn)簡單QQ登錄頁面

 更新時間:2022年04月24日 14:45:05   作者:Lssの老父親  
這篇文章主要為大家詳細介紹了Android實現(xiàn)簡單QQ登錄頁面,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

Android開發(fā)實現(xiàn)極為簡單的QQ登錄頁面,供大家參考,具體內(nèi)容如下

設計一個簡單QQ登錄頁面,無任何功能。然后打包安裝到手機。

1.首先創(chuàng)建一個空白頁面

2.打開樣式設計的頁面

在activity_main.xml中寫入代碼

<?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://相對布局
? ? ? ? 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="賬號:"
? ? ? ? ? ? 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>

在虛擬機里跑一下

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

報錯了…

網(wǎng)上查了一下解決辦法。在build.gradle文件里添點代碼:

lintOptions {
? ? ? ? checkReleaseBuilds false
? ? ? ? abortOnError false
? ? }

成功了。

挺不錯

參考圖書《Android移動開發(fā)基礎案例教程》

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

最新評論