最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android小程序?qū)崿F(xiàn)簡易QQ界面

 更新時(shí)間:2020年05月22日 16:53:55   作者:adorable_  
這篇文章主要為大家詳細(xì)介紹了Android小程序?qū)崿F(xiàn)簡易QQ界面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Android實(shí)現(xiàn)簡易QQ界面的具體代碼,供大家參考,具體內(nèi)容如下

要求:

(1)與QQ界面控件數(shù)目、樣式相同
(2)與QQ的圖形化界面相同
(3)實(shí)現(xiàn)一個(gè)簡單的點(diǎn)擊事件

具體實(shí)現(xiàn):

(1)編寫程序代碼

package com.example.login;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;
import android.widget.ToggleButton;

public class MainActivity extends Activity {
 //聲明組件 
 private EditText username;
 private EditText password;
 private Button login;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  //無標(biāo)題設(shè)置
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.activity_main);


  //初始化控件,根據(jù)Id獲取組件對(duì)象
  username = (EditText)findViewById(R.id.username);
  password = (EditText)findViewById(R.id.password);
  login = (Button)findViewById(R.id.login);

  //注冊(cè)監(jiān)聽
  login.setOnClickListener(new OnClickListener() {

   @Override
   public void onClick(View v) {
    // 登錄
    Log.i("tag", "username:"+username.getText().toString());
    Log.i("tag", "password:"+password.getText().toString());
    Toast t1 = Toast.makeText(getApplicationContext(), "登錄成功", Toast.LENGTH_LONG);
    t1.show();  
   }
  });
 }
}

(2)對(duì)應(yīng)布局文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@drawable/aa"
 android:orientation="vertical" >

 <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="#55000000"
  android:orientation="vertical"
  android:paddingLeft="30dp"
  android:paddingRight="30dp" >

  <LinearLayout
   android:layout_marginTop="80dp"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:gravity="center_vertical"
   android:orientation="horizontal" >

   <ImageView
    android:layout_width="43dp"
    android:layout_height="43dp"
    android:src="@drawable/qq" />

   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="QQ"
    android:textColor="#fff"
    android:textSize="50dp" />
  </LinearLayout>

  <EditText
   android:id="@+id/username"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="30dp"
   android:background="@null"
   android:hint="QQ號(hào)/手機(jī)號(hào)/郵箱"
   android:maxLength="13"
   android:singleLine="true"
   android:textColor="#fff"
   android:textSize="30px"
   android:textColorHint="#eee" />

  <View
   android:layout_width="match_parent"
   android:layout_height="1px"
   android:layout_marginTop="10dp"
   android:background="#eee" />

  <EditText
   android:id="@+id/password"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="10dp"
   android:background="@null"
   android:hint="密碼"
   android:inputType="textPassword"
   android:maxLength="13"
   android:singleLine="true"
   android:textColor="#fff"
   android:textSize="30px"
   android:textColorHint="#eee" />

  <View
   android:layout_width="match_parent"
   android:layout_height="1px"
   android:layout_marginTop="10dp"
   android:background="#eee" />

  <Button
   android:id="@+id/login"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="10dp"
   android:background="@drawable/button_login_bg"
   android:text="登錄"
   android:textColor="#fff"
   android:textSize="25px" />

  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="10dp"
   android:orientation="horizontal" >

   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="忘記密碼?"
    android:textColor="#cc1CA4DE"
    android:textSize="20dp" />

   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="right"
    android:text="新用戶注冊(cè)"
    android:textColor="#cc1CA4DE"
    android:textSize="20dp" />
  </LinearLayout>
 </LinearLayout>
</LinearLayout>

(3)效果如下:

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

相關(guān)文章

  • Android Kotlin Flow 冷熱流詳解

    Android Kotlin Flow 冷熱流詳解

    在Android開發(fā)中,Flow是Kotlin協(xié)程庫的重要組成部分,用于處理異步數(shù)據(jù)流,它能夠異步生產(chǎn)多個(gè)值,類似于RxJava中的Observable,本文介紹Android Kotlin Flow 冷熱流,感興趣的朋友一起看看吧
    2024-11-11
  • Android TextView高級(jí)顯示技巧實(shí)例小結(jié)

    Android TextView高級(jí)顯示技巧實(shí)例小結(jié)

    這篇文章主要介紹了Android TextView高級(jí)顯示技巧,結(jié)合實(shí)例形式總結(jié)分析了Android TextView控件進(jìn)行文字與圖片顯示的相關(guān)操作技巧,需要的朋友可以參考下
    2016-10-10
  • Android利用ContentProvider讀取短信內(nèi)容

    Android利用ContentProvider讀取短信內(nèi)容

    這篇文章主要為大家詳細(xì)介紹了Android利用ContentProvider讀取短信內(nèi)容,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-11-11
  • Android開發(fā)之保存圖片到相冊(cè)的三種方法詳解

    Android開發(fā)之保存圖片到相冊(cè)的三種方法詳解

    這篇文章主要介紹了Android開發(fā)實(shí)現(xiàn)的保存圖片到相冊(cè)功能的三種方法,文中的示例代碼講解詳細(xì),有一定的參考價(jià)值,感興趣的可以了解一下
    2022-04-04
  • listview與SQLite結(jié)合實(shí)現(xiàn)記事本功能

    listview與SQLite結(jié)合實(shí)現(xiàn)記事本功能

    這篇文章主要為大家詳細(xì)介紹了listview與SQLite結(jié)合實(shí)現(xiàn)記事本功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-12-12
  • Android利用OpenGLES繪制天空盒實(shí)例教程

    Android利用OpenGLES繪制天空盒實(shí)例教程

    這篇文章主要給大家介紹了關(guān)于Android利用OpenGLES繪制天空盒的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-08-08
  • Android編程獲取控件寬和高的方法總結(jié)分析

    Android編程獲取控件寬和高的方法總結(jié)分析

    這篇文章主要介紹了Android編程獲取控件寬和高的方法,結(jié)合實(shí)例形式對(duì)比總結(jié)并分析了Android控件屬性的相關(guān)操作技巧,需要的朋友可以參考下
    2016-01-01
  • Android中l(wèi)istview和imageview實(shí)現(xiàn)條目單選效果

    Android中l(wèi)istview和imageview實(shí)現(xiàn)條目單選效果

    這篇文章主要為大家詳細(xì)介紹了Android中l(wèi)istview和imageview實(shí)現(xiàn)條目單選效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-02-02
  • Android實(shí)現(xiàn)打開本地pdf文件的兩種方式

    Android實(shí)現(xiàn)打開本地pdf文件的兩種方式

    在現(xiàn)代應(yīng)用中,PDF格式因其跨平臺(tái)、穩(wěn)定性好、展示內(nèi)容一致等特點(diǎn),在Android平臺(tái)上,如何高效地打開本地PDF文件,不僅關(guān)系到用戶體驗(yàn),也直接影響到應(yīng)用的功能豐富度,本文將給大家詳細(xì)介紹了Android打開本地pdf文件的兩種方式,需要的朋友可以參考下
    2025-04-04
  • Android Dialog 對(duì)話框詳解及示例代碼

    Android Dialog 對(duì)話框詳解及示例代碼

    本文主要介紹Android Dialog,這里詳細(xì)介紹Android Dialog的基本使用方法,并提供了示例代碼和實(shí)現(xiàn)效果圖,有需要的小伙伴可以參考下
    2016-08-08

最新評(píng)論

吉安县| 正镶白旗| 平利县| 乐山市| 新泰市| 大余县| 翁牛特旗| 加查县| 海安县| 新津县| 孝昌县| 荆州市| 思南县| 吴桥县| 仙居县| 富平县| 淅川县| 定州市| 和林格尔县| 资阳市| 呼玛县| 榆树市| 宿州市| 菏泽市| 鄯善县| 海林市| 景德镇市| 辽阳市| 海口市| 太湖县| 玉树县| 封丘县| 交城县| 云阳县| 晋中市| 鄱阳县| 桐乡市| 拉萨市| 大同县| 荔波县| 花莲县|