<?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);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" 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"
总结
以上是内存溢出为你收集整理的第六周全部内容,希望文章能够帮你解决第六周所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)