zoukankan      html  css  js  c++  java
  • activity 张垚

    package com.example.myapplication;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    
    import org.w3c.dom.Text;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.login);
        }
    
           public void login(View view){
               EditText id = (EditText) findViewById(R.id.edit1);
               String s = id.getText().toString();
               Intent intent=new Intent();
               intent.setClass(MainActivity.this, TestActivity.class);
               intent.putExtra("id",s);
               startActivity(intent);
           }
    
    }
    

      

    package com.example.myapplication;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.TextView;
    
    public class TestActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_test);
            TextView t = (TextView)findViewById(R.id.text);
            Intent intent = this.getIntent();
    
            String id = intent.getStringExtra("id");
            System.out.println(intent.getStringExtra("id"));
            t.setText(id);
        }
    }
    

      

    <?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"
        tools:context=".MainActivity">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
    

      

    <?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"
        tools:context=".MainActivity">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
    

      

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=""></TextView>
        <ImageView
            android:id="@+id/photo"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:src="@drawable/ic_launcher_background"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="200dp"
            android:layout_marginBottom="30dp"></ImageView>
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/photo"
            android:maxLength="15"
            android:layout_marginTop="13dp"
            android:text="账号:"/>
        <EditText
            android:id="@+id/edit1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/photo"
            android:layout_toRightOf="@id/textView1"
            android:hint="请输入您的账号"></EditText>
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/textView1"
            android:maxLength="20"
            android:layout_marginTop="25dp"
            android:text="密码:" />
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/textView1"
            android:layout_toRightOf="@id/textView2"
            android:layout_marginTop="10dp"
            android:hint="请输入您的密码"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button"
            android:text="登录"
            android:textColor="#478595"
            android:layout_below="@id/textView2"
            android:layout_marginTop="20dp"
            android:layout_marginLeft="120dp"
            android:layout_centerHorizontal="true"
            android:onClick="login">
        </Button>
    
    </RelativeLayout>
    

      

  • 相关阅读:
    zabbix客户端自动注册
    运维监控篇(2)_Zabbix简单的性能调优
    Zabbix unreachable poller processes more than 75% busy
    RabbitMQ 内存控制 硬盘控制
    RabbitMQ的Q&A
    RabbitMQ性能优化
    消息默认的属性
    RabbitMQ的Vhost,Exchange,Queue原理分析
    逻辑运算符(&& || and or)
    面向对象
  • 原文地址:https://www.cnblogs.com/ZXCVBNM1314/p/13857700.html
Copyright © 2011-2022 走看看