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

Android實(shí)現(xiàn)注冊(cè)頁(yè)面

 更新時(shí)間:2022年04月23日 16:04:59   作者:上進(jìn)@李小白  
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)注冊(cè)頁(yè)面之監(jiān)聽(tīng)器,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文用Android studio制作了簡(jiǎn)單的手機(jī)QQ登錄界面,其中界面的布局采用了線性布局、表格布局(不固定布局方法),并給控件綁定監(jiān)聽(tīng)器,當(dāng)用戶點(diǎn)擊登陸按鈕時(shí),把用戶所填寫的注冊(cè)內(nèi)容顯示在“注冊(cè)”按鈕下面的文本框內(nèi)。

實(shí)現(xiàn)的效果圖:

代碼:

package com.example.project309;
?
import androidx.appcompat.app.AppCompatActivity;
?
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
?
public class MainActivity extends AppCompatActivity {
? ? EditText name;
? ? EditText password;
? ? RadioButton man;
? ? RadioButton woman;
? ? Button ?show;
? ? TextView shower;
? ? CheckBox auto;
? ? CheckBox remember;
? ? String ?result="";
?
? ? @Override
? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_main);
? ? ? ? name = findViewById(R.id.name);
? ? ? ? password = findViewById(R.id.password);
? ? ? ? man = findViewById(R.id.man);
? ? ? ? woman = findViewById(R.id.woman);
? ? ? ? show = findViewById(R.id.show);
? ? ? ? shower = findViewById(R.id.shower);
? ? ? ? auto = findViewById(R.id.auto);
? ? ? ? remember = findViewById(R.id.remember);
? ? ? ? show.setOnClickListener(this::onClick);
? ? }
? ? public void onClick(View v){
? ? ? ? String user = name.getText().toString();
? ? ? ? result +="姓名:"+user+"\n";
? ? ? ? String pass =password.getText().toString();
? ? ? ? result +="密碼:"+pass+"\n";
? ? ? ? if(man.isChecked()){
? ? ? ? ? ? result+="性別:"+man.getText().toString()+"\n"+"設(shè)置:";
? ? ? ? }
? ? ? ? if(woman.isChecked()){
? ? ? ? ? ? result+="性別:"+woman.getText().toString()+"\n"+"設(shè)置:";
? ? ? ? }
? ? ? ? if(auto.isChecked()){
? ? ? ? ? ? result+=auto.getText().toString()+" ";
? ? ? ? }
? ? ? ? if(remember.isChecked()){
? ? ? ? ? ? result+=remember.getText().toString()+" ";
? ? ? ? }
? ? ? ?shower.setText(result);
? ? }
}

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
? ? tools:context=".MainActivity">
<LinearLayout
? ? android:layout_width="wrap_content"
? ? android:layout_height="wrap_content"
? ? android:orientation="horizontal">
? ? <ImageView
? ? ? ? android:layout_width="180dp"
? ? ? ? android:layout_height="159dp"
? ? ? ? android:src="@drawable/qq" />
? ? <LinearLayout
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:orientation="vertical"
? ? ? ? >
?
? ? <TableLayout
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:id="@+id/table1">
?
? ? ? ? <TableRow>
?
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="用戶名"
? ? ? ? ? ? ? ? android:textColor="#000000"
? ? ? ? ? ? ? ? android:textSize="20dp" />
?
? ? ? ? ? ? <EditText
? ? ? ? ? ? ? ? android:id="@+id/name"
? ? ? ? ? ? ? ? android:layout_width="150dp"
? ? ? ? ? ? ? ? android:layout_height="wrap_content" />
?
? ? ? ? </TableRow>
?
? ? ? ? <TableRow>
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="密碼"
? ? ? ? ? ? ? ? android:textColor="#000000"
? ? ? ? ? ? ? ? android:textSize="20dp" />
? ? ? ? ? ? <EditText
? ? ? ? ? ? ? ? android:id="@+id/password"
? ? ? ? ? ? ? ? android:layout_width="150dp"
? ? ? ? ? ? ? ? android:layout_height="wrap_content" />
?
? ? ? ? </TableRow>
? ? ? ?<TableRow>
? ? ? ? ? ? <RadioButton
? ? ? ? ? ? ? ? android:id="@+id/man"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="男" />
?
? ? ? ? ? ? <RadioButton
? ? ? ? ? ? ? ? android:id="@+id/woman"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text="女" />
?
? ? ? ?</TableRow>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:orientation="horizontal"
? ? ? ? ? ? >
? ? ? ? ? ? <CheckBox
? ? ? ? ? ? ? ? android:id="@+id/auto"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:checked="true"
? ? ? ? ? ? ? ? android:text="自動(dòng)登錄"
? ? ? ? ? ? ? ? android:textSize="18dp" />
?
? ? ? ? ? ? <CheckBox
? ? ? ? ? ? ? ? android:id="@+id/remember"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:checked="true"
? ? ? ? ? ? ? ? android:text="記住密碼"
? ? ? ? ? ? ? ? android:textSize="18dp" />
? ? ? ? </LinearLayout>
? ? </TableLayout>
? ? </LinearLayout>
</LinearLayout>
? ? <Button
? ? ? ? android:id="@+id/show"
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:text="注冊(cè)"
? ? ? ? android:textSize="20dp"
? ? ? ? />
? ? <TextView
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="300dp"
? ? ? ? android:id="@+id/shower"/>
</LinearLayout>

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

相關(guān)文章

  • Android實(shí)現(xiàn)折線圖小工具

    Android實(shí)現(xiàn)折線圖小工具

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)折線圖小工具,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-09-09
  • flutter實(shí)現(xiàn)發(fā)送驗(yàn)證碼功能

    flutter實(shí)現(xiàn)發(fā)送驗(yàn)證碼功能

    這篇文章主要為大家詳細(xì)介紹了flutter發(fā)送驗(yàn)證碼功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-07-07
  • 一文詳解Flutter Widget和App的生命周期

    一文詳解Flutter Widget和App的生命周期

    這篇文章主要為大家介紹了Flutter Widget和App的生命周期示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-08-08
  • Android uses-permission權(quán)限列表中文注釋版

    Android uses-permission權(quán)限列表中文注釋版

    Android有一個(gè)精心設(shè)計(jì)的安全模型。每一個(gè)應(yīng)用都有其自己Linux用戶和群組,在單獨(dú)的進(jìn)程和VM上運(yùn)行,不能影響到其他應(yīng)用
    2014-05-05
  • Android使用ViewFlipper實(shí)現(xiàn)上下滾動(dòng)消息

    Android使用ViewFlipper實(shí)現(xiàn)上下滾動(dòng)消息

    這篇文章主要為大家詳細(xì)介紹了Android使用ViewFlipper實(shí)現(xiàn)上下滾動(dòng)消息,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-07-07
  • Android自定義EditText右側(cè)帶圖片控件

    Android自定義EditText右側(cè)帶圖片控件

    這篇文章主要為大家詳細(xì)介紹了Android自定義EditText右側(cè)帶圖片控件的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-10-10
  • Android Studio下Flutter環(huán)境搭建圖文教程

    Android Studio下Flutter環(huán)境搭建圖文教程

    這篇文章主要為大家詳細(xì)介紹了Android Studio下Flutter環(huán)境搭建圖文教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-07-07
  • Flutter正確使用圖片資源方法詳解

    Flutter正確使用圖片資源方法詳解

    這篇文章主要為大家介紹了Flutter正確使用圖片資源方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-08-08
  • Rocksdb?Memtable數(shù)據(jù)結(jié)構(gòu)源碼解析

    Rocksdb?Memtable數(shù)據(jù)結(jié)構(gòu)源碼解析

    這篇文章主要為大家介紹了Rocksdb?Memtable數(shù)據(jù)結(jié)構(gòu)源碼解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-11-11
  • Android仿IOS底部彈出對(duì)話框

    Android仿IOS底部彈出對(duì)話框

    這篇文章主要為大家詳細(xì)介紹了Android仿IOS底部彈出對(duì)話框的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-01-01

最新評(píng)論