1.主要代码
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; <pre name="code" class="html">package cn.edu.example.b_2_2_tizhong; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; public class SecondActivity extends MainActivity { private TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_two); textView = (TextView) this.findViewById(R.id.tV2_1); Intent intent = getIntent(); String xingbie = intent.getStringExtra("xingbie"); String shengao = intent.getStringExtra("shengao"); String tizhong = intent.getStringExtra("tizhong"); textView.setText(xingbie+shengao+tizhong); } }
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74<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" tools:context="cn.edu.example.b_2_2_tizhong.MainActivity" > <TextView android:id="@+id/tV1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="14dp" android:text="@string/tV1" android:textAppearance="?android:attr/textAppearanceLarge" /> <RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/tV1" android:layout_alignTop="@+id/tV2" android:layout_marginLeft="26dp" android:orientation="horizontal" > <RadioButton android:id="@+id/rB1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/rB1" /> <RadioButton android:id="@+id/rB2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="38dp" android:layout_marginRight="21dp" android:text="@string/rB2" /> </RadioGroup> <TextView android:id="@+id/tV2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tV1" android:layout_marginTop="38dp" android:layout_toLeftOf="@+id/radioGroup1" android:text="@string/tV2" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/tV3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/radioGroup1" android:layout_marginTop="53dp" android:layout_toLeftOf="@+id/radioGroup1" android:text="@string/tV3" android:textAppearance="?android:attr/textAppearanceMedium" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/tV3" android:layout_alignBottom="@+id/tV3" android:hint="@string/eT1" android:background="@android:drawable/edit_text" android:layout_alignLeft="@+id/radioGroup1" android:ems="10" android:inputType="number" /> <Button android:id="@+id/bu1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:layout_centerHorizontal="true" android:layout_marginTop="64dp" android:background="@android:color/holo_blue_dark" android:text="@string/bu1" /> </RelativeLayout>
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/tV2_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="69dp" android:layout_marginTop="40dp" android:textAppearance="?android:attr/textAppearanceMedium" /> </RelativeLayout
复制代码
1
复制代码
1
2
2.运行效果图
复制代码
1
最后
以上就是勤奋指甲油最近收集整理的关于身高体重计算器1.主要代码的全部内容,更多相关身高体重计算器1内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复