登录界面

登录界面,第1张

概述登录<?xmlversion="1.0"encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apkes/android"package="com.example.login1"><applicationandroid:allowBackup="tr

登录

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"    package="com.example.login1">    <application        androID:allowBackup="true"        androID:icon="@mipmap/ic_launcher"        androID:label="@string/app_name"        androID:roundIcon="@mipmap/ic_launcher_round"        androID:supportsRtl="true"        androID:theme="@style/Apptheme">        <activity androID:name=".MainActivity">            <intent-filter>                <action androID:name="androID.intent.action.MAIN" />                <category androID:name="androID.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <activity androID:name=".secondActivity"/>    </application></manifest>
package com.example.login1;import androIDx.appcompat.app.AppCompatActivity;import androID.content.Intent;import androID.os.Bundle;import androID.os.Parcelable;import androID.vIEw.VIEw;import androID.Widget.button;import androID.Widget.CheckBox;import androID.Widget.Compoundbutton;import androID.Widget.EditText;import androID.Widget.Radiobutton;import androID.Widget.RadioGroup;import androID.Widget.TextVIEw;import com.example.login1.R;public class MainActivity extends AppCompatActivity implements Compoundbutton.OnCheckedchangelistener {    private String hobbys;    final Intent intent = new Intent();    private EditText name;    private EditText password;    @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.activity_main);        name = (EditText)findVIEwByID(R.ID.etname);        password = (EditText)findVIEwByID(R.ID.etpass);        RadioGroup  rg = (RadioGroup)findVIEwByID(R.ID.rg);        CheckBox print = (CheckBox)findVIEwByID(R.ID.print);        CheckBox basketball = (CheckBox)findVIEwByID(R.ID.basketball);        CheckBox sing = (CheckBox)findVIEwByID(R.ID.sing);        CheckBox dance = (CheckBox)findVIEwByID(R.ID.dance);        hobbys = new String();        //设置跳转到的Activity        intent.setClass(MainActivity.this,secondActivity.class);        //为RadioGroup设置监听        rg.setonCheckedchangelistener(new RadioGroup.OnCheckedchangelistener() {            @OverrIDe            public voID onCheckedChanged(RadioGroup radioGroup, int i) {                if (i == R.ID.girl){                    intent.putExtra("gender", "女");                }else if (i == R.ID.boy){                    intent.putExtra("gender", "男");                }            }        });        //为CheckBox设置监听        print.setonCheckedchangelistener(this);        basketball.setonCheckedchangelistener(this);        sing.setonCheckedchangelistener(this);        dance.setonCheckedchangelistener(this);        //为 button设置监听        button button = (button)findVIEwByID(R.ID.button);        button.setonClickListener(new VIEw.OnClickListener() {            @OverrIDe            public voID onClick(VIEw vIEw) {                Bundle bundle = new Bundle();                bundle.putString("name",name.getText().toString());                bundle.putString("password",password.getText().toString());                intent.putExtras(bundle);                startActivity(intent);            }        });    }    @OverrIDe    public voID onCheckedChanged(Compoundbutton compoundbutton, boolean b) {        String motion = compoundbutton.getText().toString();        if (b){            if(!hobbys.contains(motion)){                hobbys = hobbys + motion;                intent.putExtra("hobbys", hobbys);            }        }else{            if (hobbys.contains(motion)){                hobbys = hobbys.replace(motion,"");                intent.putExtra("hobbys", hobbys);            }        }    }}
package com.example.login1;import androID.app.Activity;import androID.content.Intent;import androID.os.Bundle;import androID.Widget.EditText;import androID.Widget.TextVIEw;import com.example.login1.R;public class secondActivity extends Activity {    public voID startActivity(Intent intent){    }    protected voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.news);        TextVIEw show_name = (TextVIEw)findVIEwByID(R.ID.show_name);        TextVIEw show_pass =(TextVIEw)findVIEwByID(R.ID.show_pass);        TextVIEw show_gender = (TextVIEw)findVIEwByID(R.ID.show_gender);        TextVIEw show_hobby =(TextVIEw)findVIEwByID(R.ID.show_hobby);        Intent intent = getIntent();        Bundle bundle = getIntent().getExtras();        show_name.setText(bundle.getString("name"));        show_pass.setText(bundle.getString("password"));        show_gender.setText(intent.getStringExtra("gender"));        show_hobby.setText(intent.getStringExtra("hobbys"));    }    public voID finish(){    }}
<?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:background="#F5F4F4"    androID:orIEntation="vertical"    tools:context=".MainActivity">    <TextVIEw        androID:ID="@+ID/textVIEw"        androID:layout_wIDth="match_parent"        androID:layout_height="40dp"        androID:background="#00BCD4"        androID:enabled="true"        androID:gravity="center"        androID:text="注册界面"        androID:textcolor="#FF5722"        androID:textSize="30sp" />    <tableLayout        androID:layout_wIDth="match_parent"        androID:layout_height="200dp"        androID:gravity="center">        <tableRow            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:gravity="center">            <TextVIEw                androID:ID="@+ID/name"                androID:layout_wIDth="wrap_content"                androID:layout_height="30dp"                androID:enabled="true"                androID:text="用户名:"                androID:textSize="20sp"                androID:textStyle="bold" />            <EditText                androID:ID="@+ID/etname"                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:ems="10"                androID:inputType="textPersonname" />        </tableRow>        <tableRow            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:gravity="center">            <TextVIEw                androID:ID="@+ID/password"                androID:layout_wIDth="wrap_content"                androID:layout_height="30dp"                androID:enabled="true"                androID:text="密码:"                androID:textSize="20sp"                androID:textStyle="bold" />            <EditText                androID:ID="@+ID/etpass"                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:ems="10"                androID:inputType="numberPassword" />        </tableRow>    </tableLayout>    <tableLayout        androID:layout_wIDth="match_parent"        androID:layout_height="150dp"        androID:gravity="center">        <tableRow            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:gravity="center">            <TextVIEw                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:enabled="true"                androID:text="性别:"                androID:textSize="20sp"                androID:textStyle="bold" />            <RadioGroup                androID:ID="@+ID/rg"                androID:layout_wIDth="220dp"                androID:layout_height="wrap_content"                androID:orIEntation="horizontal">                <Radiobutton                    androID:ID="@+ID/girl"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:layout_weight="1"                    androID:text="女" />                <Radiobutton                    androID:ID="@+ID/boy"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:layout_weight="1"                    androID:text="男" />            </RadioGroup>        </tableRow>        <tableRow            androID:layout_wIDth="match_parent"            androID:layout_height="200dp"            androID:gravity="center">            <TextVIEw                androID:ID="@+ID/textVIEw7"                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:enabled="true"                androID:text="爱好:"                androID:textSize="20sp"                androID:textStyle="bold" />            <linearLayout                androID:layout_wIDth="match_parent"                androID:layout_height="match_parent"                androID:orIEntation="horizontal">                <CheckBox                    androID:ID="@+ID/print"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:layout_weight="1"                    androID:text="绘画" />                <CheckBox                    androID:ID="@+ID/basketball"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:layout_weight="1"                    androID:text="打篮球" />            </linearLayout>    
<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:orIEntation="vertical">    <TextVIEw        androID:ID="@+ID/textVIEw2"        androID:layout_wIDth="match_parent"        androID:layout_height="40dp"        androID:background="#00BCD4"        androID:gravity="center"        androID:text="注册信息"        androID:textcolor="#FF5722"        androID:textSize="25sp" />    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:layout_margin="25dp"        androID:gravity="center"        androID:orIEntation="vertical">        <TextVIEw            androID:ID="@+ID/textVIEw3"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:text="你的注册信息是:"            androID:textSize="20sp" />        <tableLayout            androID:layout_wIDth="match_parent"            androID:layout_height="400dp">            <tableRow                androID:layout_wIDth="match_parent"                androID:layout_height="match_parent">                <TextVIEw                    androID:ID="@+ID/textVIEw4"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:text="用户名:"                    androID:textSize="20sp" />                <TextVIEw                    androID:ID="@+ID/show_name"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content" />            </tableRow>            <tableRow                androID:layout_wIDth="match_parent"                androID:layout_height="match_parent">                <TextVIEw                    androID:ID="@+ID/textVIEw9"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:text="密码:"                    androID:textSize="20sp" />                <TextVIEw                    androID:ID="@+ID/show_pass"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content" />            </tableRow>            <tableRow                androID:layout_wIDth="match_parent"                androID:layout_height="match_parent">                <TextVIEw                    androID:ID="@+ID/textVIEw11"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:text="性别:"                    androID:textSize="20sp" />                <TextVIEw                    androID:ID="@+ID/show_gender"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content" />            </tableRow>            <tableRow                androID:layout_wIDth="match_parent"                androID:layout_height="match_parent">                <TextVIEw                    androID:ID="@+ID/textVIEw13"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:text="爱好:"                    androID:textSize="20sp" />                <TextVIEw                    androID:ID="@+ID/show_hobby"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content" />            </tableRow>        </tableLayout>    </linearLayout></linearLayout>

 

总结

以上是内存溢出为你收集整理的登录界面全部内容,希望文章能够帮你解决登录界面所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1058014.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存