<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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="com.example.administrator.a04234.MainActivity">
<TextView
android:layout_gravity="center"
android:layout_width="300dp"
android:layout_height="300dp"
android:background="#FF0000"/>
<TextView
android:layout_gravity="center"
android:layout_width="250dp"
android:layout_height="250dp"
android:background="#00FF00"/>
<TextView
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#FF0000"/>
<TextView
android:layout_gravity="center"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="#00FF00"/>
<TextView
android:layout_gravity="center"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FF0000"/>
<TextView
android:layout_gravity="center"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#00FF00"/>
</FrameLayout>
15:46:59
Yongli 2018/4/23 15:46:59
Button btnOpen = (Button)findViewById(R.id.btnOpen);
btnOpen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this,
Main2Activity.class);
/*intent.putExtra("name", "zhangsan");
intent.putExtra("age", "18");*/
Bundle bundle = new Bundle();
bundle.putString("name", "zhangsan");
bundle.putString("age", "18");
intent.putExtras(bundle);
startActivity(intent);
}
});
15:47:07
Yongli 2018/4/23 15:47:07
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
String name = bundle.getString("name");
String age = bundle.getString("age");
/*String name = intent.getStringExtra("name");
String age = intent.getStringExtra("age");*/
Log.d(TAG, "onCreate: "+name+"\t"+age);
15:49:44
Yongli 2018/4/23 15:49:44
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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"
android:columnCount="4"
android:rowCount="3"
tools:context="com.example.administrator.a04234.MainActivity">
<Button android:text="1" android:layout_columnSpan="2" android:layout_gravity="fill"/>
<Button android:text="2" android:layout_rowSpan="2" android:layout_gravity="fill"/>
<Button android:text="3"/>
<Button android:text="4"/>
<Button android:text="5"/>
<Button android:text="6"/>
<Button android:text="7"/>
</GridLayout>
15:52:21
Yongli 2018/4/23 15:52:21
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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="com.example.administrator.a04234.MainActivity">
<TableRow>
<Button android:text="1"/>
<Button android:text="2"/>
<Button android:text="3"/>
</TableRow>
<TableRow>
<Button android:text="1"/>
<Button android:text="2"/>
<Button android:text="3"/>
</TableRow>
<TableRow>
<Button android:text="1"/>
<Button android:text="2" android:layout_span="2"/>
</TableRow>
</TableLayout>
15:55:18
Yongli 2018/4/23 15:55:18
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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="com.example.administrator.a04234.MainActivity">
<TextView
android:id="@+id/tvInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入:"/>
<EditText
android:id="@+id/etText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tvInput"/>
<Button
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_below="@id/etText"
android:layout_alignRight="@id/etText"/>
<Button
android:id="@+id/btnOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"
android:layout_below="@id/etText"
android:layout_toLeftOf="@id/btnCancel"/>
</RelativeLayout>
Yongli 2018/4/23 15:56:52
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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"
android:orientation="vertical"
tools:context="com.example.administrator.a04234.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入:"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"/>
</LinearLayout>
</LinearLayout>
15:57:39
Yongli 2018/4/23 15:57:39
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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"
android:orientation="vertical"
tools:context="com.example.administrator.a04234.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
</LinearLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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="com.example.administrator.a04234.MainActivity">
<TextView
android:layout_gravity="center"
android:layout_width="300dp"
android:layout_height="300dp"
android:background="#FF0000"/>
<TextView
android:layout_gravity="center"
android:layout_width="250dp"
android:layout_height="250dp"
android:background="#00FF00"/>
<TextView
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#FF0000"/>
<TextView
android:layout_gravity="center"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="#00FF00"/>
<TextView
android:layout_gravity="center"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FF0000"/>
<TextView
android:layout_gravity="center"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#00FF00"/>
</FrameLayout>
15:46:59
Yongli 2018/4/23 15:46:59
Button btnOpen = (Button)findViewById(R.id.btnOpen);
btnOpen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this,
Main2Activity.class);
/*intent.putExtra("name", "zhangsan");
intent.putExtra("age", "18");*/
Bundle bundle = new Bundle();
bundle.putString("name", "zhangsan");
bundle.putString("age", "18");
intent.putExtras(bundle);
startActivity(intent);
}
});
15:47:07
Yongli 2018/4/23 15:47:07
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
String name = bundle.getString("name");
String age = bundle.getString("age");
/*String name = intent.getStringExtra("name");
String age = intent.getStringExtra("age");*/
Log.d(TAG, "onCreate: "+name+"\t"+age);
15:49:44
Yongli 2018/4/23 15:49:44
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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"
android:columnCount="4"
android:rowCount="3"
tools:context="com.example.administrator.a04234.MainActivity">
<Button android:text="1" android:layout_columnSpan="2" android:layout_gravity="fill"/>
<Button android:text="2" android:layout_rowSpan="2" android:layout_gravity="fill"/>
<Button android:text="3"/>
<Button android:text="4"/>
<Button android:text="5"/>
<Button android:text="6"/>
<Button android:text="7"/>
</GridLayout>
15:52:21
Yongli 2018/4/23 15:52:21
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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="com.example.administrator.a04234.MainActivity">
<TableRow>
<Button android:text="1"/>
<Button android:text="2"/>
<Button android:text="3"/>
</TableRow>
<TableRow>
<Button android:text="1"/>
<Button android:text="2"/>
<Button android:text="3"/>
</TableRow>
<TableRow>
<Button android:text="1"/>
<Button android:text="2" android:layout_span="2"/>
</TableRow>
</TableLayout>
15:55:18
Yongli 2018/4/23 15:55:18
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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="com.example.administrator.a04234.MainActivity">
<TextView
android:id="@+id/tvInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入:"/>
<EditText
android:id="@+id/etText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tvInput"/>
<Button
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_below="@id/etText"
android:layout_alignRight="@id/etText"/>
<Button
android:id="@+id/btnOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"
android:layout_below="@id/etText"
android:layout_toLeftOf="@id/btnCancel"/>
</RelativeLayout>
Yongli 2018/4/23 15:56:52
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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"
android:orientation="vertical"
tools:context="com.example.administrator.a04234.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入:"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"/>
</LinearLayout>
</LinearLayout>
15:57:39
Yongli 2018/4/23 15:57:39
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android
"
xmlns:tools="http://schemas.android.com/tools
"
android:id="@+id/activity_main"
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"
android:orientation="vertical"
tools:context="com.example.administrator.a04234.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入:"
android:layout_weight="1"/>
</LinearLayout>