Skip to content

Commit 4835a77

Browse files
committed
b2の設定途中
1 parent 183838c commit 4835a77

File tree

4 files changed

+224
-7
lines changed

4 files changed

+224
-7
lines changed

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ dependencies {
2525
testImplementation 'junit:junit:4.12'
2626
androidTestImplementation 'com.android.support.test:runner:1.0.2'
2727
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28+
implementation 'com.android.support:design:28.0.0'
2829
}

app/src/main/java/com/example/dojo/myapplication/MainActivity.java

+27
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,39 @@
22

33
import android.support.v7.app.AppCompatActivity;
44
import android.os.Bundle;
5+
import android.view.View;
6+
import android.widget.Button;
7+
import android.widget.TextView;
58

69
public class MainActivity extends AppCompatActivity {
10+
int num1,num2;
11+
int state;
12+
TextView t1;
713

814
@Override
915
protected void onCreate(Bundle savedInstanceState) {
1016
super.onCreate(savedInstanceState);
1117
setContentView(R.layout.activity_main);
18+
19+
state = 0;
20+
21+
t1 = findViewById(R.id.text);
22+
23+
Button b1 = findViewById(R.id.button23);
24+
b1.setOnClickListener(new View.OnClickListener() {
25+
@Override
26+
public void onClick(View v) {
27+
String tmp = t1.getText().toString();
28+
tmp += "1";
29+
t1.setText(tmp);
30+
}
31+
});
32+
33+
Button b2 = findViewById(R.id.button24);
34+
b2.setOnClickListener(new View.OnClickListener() {
35+
@Override
36+
public void onClick(View v) {
37+
num1 =
38+
}
1239
}
1340
}

app/src/main/res/layout/activity_main.xml

+190-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,196 @@
66
android:layout_height="match_parent"
77
tools:context=".MainActivity">
88

9-
<TextView
10-
android:layout_width="wrap_content"
11-
android:layout_height="wrap_content"
12-
android:text="Hello World!"
9+
<LinearLayout
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"
12+
android:orientation="vertical"
1313
app:layout_constraintBottom_toBottomOf="parent"
14-
app:layout_constraintLeft_toLeftOf="parent"
15-
app:layout_constraintRight_toRightOf="parent"
16-
app:layout_constraintTop_toTopOf="parent" />
14+
app:layout_constraintEnd_toEndOf="parent"
15+
app:layout_constraintStart_toStartOf="parent"
16+
app:layout_constraintTop_toTopOf="parent">
17+
18+
<TextView
19+
android:id="@+id/textView"
20+
android:layout_width="match_parent"
21+
android:layout_height="160dp"
22+
android:text="TextView" />
23+
24+
<LinearLayout
25+
android:layout_width="match_parent"
26+
android:layout_height="wrap_content"
27+
android:gravity="top"
28+
android:orientation="horizontal">
29+
30+
<Button
31+
android:id="@+id/button5"
32+
android:layout_width="wrap_content"
33+
android:layout_height="120dp"
34+
android:layout_weight="1"
35+
android:text="(" />
36+
37+
<Button
38+
android:id="@+id/button6"
39+
android:layout_width="wrap_content"
40+
android:layout_height="120dp"
41+
android:layout_weight="1"
42+
android:text=")" />
43+
44+
<Button
45+
android:id="@+id/button7"
46+
android:layout_width="wrap_content"
47+
android:layout_height="120dp"
48+
android:layout_weight="1"
49+
android:text="%" />
50+
51+
<Button
52+
android:id="@+id/button12"
53+
android:layout_width="wrap_content"
54+
android:layout_height="120dp"
55+
android:layout_weight="1"
56+
android:text="AC" />
57+
58+
</LinearLayout>
59+
60+
<LinearLayout
61+
android:layout_width="match_parent"
62+
android:layout_height="wrap_content"
63+
android:gravity="bottom"
64+
android:orientation="horizontal">
65+
66+
<Button
67+
android:id="@+id/button15"
68+
android:layout_width="wrap_content"
69+
android:layout_height="120dp"
70+
android:layout_weight="1"
71+
android:text="7" />
72+
73+
<Button
74+
android:id="@+id/button16"
75+
android:layout_width="wrap_content"
76+
android:layout_height="120dp"
77+
android:layout_weight="1"
78+
android:text="8" />
79+
80+
<Button
81+
android:id="@+id/button17"
82+
android:layout_width="wrap_content"
83+
android:layout_height="120dp"
84+
android:layout_weight="1"
85+
android:text="9" />
86+
87+
<Button
88+
android:id="@+id/button18"
89+
android:layout_width="wrap_content"
90+
android:layout_height="120dp"
91+
android:layout_weight="1"
92+
android:text="÷" />
93+
94+
</LinearLayout>
95+
96+
<LinearLayout
97+
android:layout_width="match_parent"
98+
android:layout_height="wrap_content"
99+
android:orientation="horizontal">
100+
101+
<Button
102+
android:id="@+id/button19"
103+
android:layout_width="wrap_content"
104+
android:layout_height="120dp"
105+
android:layout_weight="1"
106+
android:text="4" />
107+
108+
<Button
109+
android:id="@+id/button20"
110+
android:layout_width="wrap_content"
111+
android:layout_height="120dp"
112+
android:layout_weight="1"
113+
android:text="5" />
114+
115+
<Button
116+
android:id="@+id/button21"
117+
android:layout_width="wrap_content"
118+
android:layout_height="120dp"
119+
android:layout_weight="1"
120+
android:text="6" />
121+
122+
<Button
123+
android:id="@+id/button22"
124+
android:layout_width="wrap_content"
125+
android:layout_height="120dp"
126+
android:layout_weight="1"
127+
android:text="×" />
128+
129+
</LinearLayout>
130+
131+
<LinearLayout
132+
android:layout_width="match_parent"
133+
android:layout_height="wrap_content"
134+
android:orientation="horizontal">
135+
136+
<Button
137+
android:id="@+id/button23"
138+
android:layout_width="wrap_content"
139+
android:layout_height="120dp"
140+
android:layout_weight="1"
141+
android:text="1" />
142+
143+
<Button
144+
android:id="@+id/button24"
145+
android:layout_width="wrap_content"
146+
android:layout_height="120dp"
147+
android:layout_weight="1"
148+
android:text="2" />
149+
150+
<Button
151+
android:id="@+id/button25"
152+
android:layout_width="wrap_content"
153+
android:layout_height="120dp"
154+
android:layout_weight="1"
155+
android:text="3" />
156+
157+
<Button
158+
android:id="@+id/button26"
159+
android:layout_width="wrap_content"
160+
android:layout_height="120dp"
161+
android:layout_weight="1"
162+
android:text="-" />
163+
</LinearLayout>
164+
165+
<LinearLayout
166+
android:layout_width="match_parent"
167+
android:layout_height="wrap_content"
168+
android:orientation="horizontal">
169+
170+
<Button
171+
android:id="@+id/button27"
172+
android:layout_width="wrap_content"
173+
android:layout_height="120dp"
174+
android:layout_weight="1"
175+
android:text="0" />
176+
177+
<Button
178+
android:id="@+id/button28"
179+
android:layout_width="wrap_content"
180+
android:layout_height="120dp"
181+
android:layout_weight="1"
182+
android:text="." />
183+
184+
<Button
185+
android:id="@+id/button29"
186+
android:layout_width="wrap_content"
187+
android:layout_height="120dp"
188+
android:layout_weight="1"
189+
android:text="=" />
190+
191+
<Button
192+
android:id="@+id/button30"
193+
android:layout_width="wrap_content"
194+
android:layout_height="120dp"
195+
android:layout_weight="1"
196+
android:text="+" />
197+
</LinearLayout>
198+
199+
</LinearLayout>
17200

18201
</android.support.constraint.ConstraintLayout>

0 commit comments

Comments
 (0)