• 安卓


    package com.example.aaa;
    import com.example.test.R;
    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    public class MainActivity extends Activity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }  
    }
    

      

    package com.example.aaa;
    import com.example.test.R;
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.EditText;
    import android.widget.TextView;
    public class RegistActivity extends Activity {
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.regist);
        }
        public void click(View v) {
            Intent intent = new Intent();
            String name = ((EditText) findViewById(R.id.editText1)).getText()
                    .toString();
            int age = Integer.parseInt(((EditText) findViewById(R.id.editText2))
                    .getText().toString());
            intent.putExtra("name", name);
            intent.putExtra("age", age);
            setResult(1, intent);
            finish();
        }
    }
    复制代码
    

      

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".MainActivity" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"  
            android:text="你的注册信息是" />
        <Button
            android:id="@+id/btn1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="注册" 
            android:onClick="regist"/>
    </RelativeLayout>
    

      

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".MainActivity" >
        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/textView1"
            android:layout_alignBottom="@+id/textView1"
            android:layout_alignParentRight="true"
            android:ems="10" />
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="74dp"
            android:text="姓名" />
        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/editText1"
            android:layout_below="@+id/editText1"
            android:layout_marginTop="33dp"
            android:ems="10" />
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/editText2"
            android:layout_alignBottom="@+id/editText2"
            android:layout_alignLeft="@+id/textView1"
            android:text="年龄" />
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/editText2"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="91dp"
            android:onClick="click"
            android:text="返回" />
    </RelativeLayout>
    

      

  • 相关阅读:
    addEventListener和attachEvent的区别
    CSS鼠标手势
    css颜色代码大全
    js中showModalDialog的使用
    ajax详解
    JS中offsetTop、clientTop、scrollTop、offsetTop各属性介绍
    js中Ajax工作原理(转)
    浏览器版本信息判断整理
    常见浏览器User-Agent大全
    JS性能优化之怎么加载JS文件
  • 原文地址:https://www.cnblogs.com/wu-di-821-821/p/14134572.html
Copyright © 2020-2023  润新知