質問編集履歴
3
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
androidで
|
1
|
+
androidでアプリについて
|
test
CHANGED
File without changes
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
androidで電卓を作っています。xmlで数字+-×÷c=のボタンを作成しました。
|
2
|
+
|
1
|
-
|
3
|
+
下記の実装で加算までのコードを書いてみたところで実行してボタンを押すと数値が入力されるところまで出来ました。
|
2
4
|
|
3
5
|
① イコールの実装がどう書いたら良いかわかりません。
|
4
6
|
|
1
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
電卓アプリ
|
1
|
+
androidで電卓アプリを作っています。
|
test
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
androidで電卓を作っています。加算までのコードを書いて実行
|
1
|
+
androidで電卓を作っています。加算までのコードを書いてみたところで実行すると数値が入力されるところまで出来ました。
|
2
2
|
|
3
|
-
|
3
|
+
① イコールの実装がどう書いたら良いかわかりません。
|
4
|
+
|
5
|
+
② イコールのコードを書けば//加算のコードで加算できるようになりますでしょうか?
|
6
|
+
|
7
|
+
よろしくおねがいします。
|
4
8
|
|
5
9
|
|
6
10
|
|
@@ -140,7 +144,9 @@
|
|
140
144
|
|
141
145
|
}
|
142
146
|
|
147
|
+
//加算
|
148
|
+
|
143
|
-
|
149
|
+
pbutton = (Button) findViewById(R.id.buttonplus);
|
144
150
|
|
145
151
|
pbutton.setOnClickListener(new View.OnClickListener() {
|
146
152
|
|
@@ -169,391 +175,3 @@
|
|
169
175
|
}
|
170
176
|
|
171
177
|
}
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
xml
|
178
|
-
|
179
|
-
<?xml version="1.0" encoding="utf-8"?>
|
180
|
-
|
181
|
-
<RelativeLayout
|
182
|
-
|
183
|
-
xmlns:android="http://schemas.android.com/apk/res/android"
|
184
|
-
|
185
|
-
xmlns:tools="http://schemas.android.com/tools"
|
186
|
-
|
187
|
-
android:layout_width="match_parent"
|
188
|
-
|
189
|
-
android:layout_height="match_parent">
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
<LinearLayout
|
194
|
-
|
195
|
-
android:layout_width="match_parent"
|
196
|
-
|
197
|
-
android:layout_height="wrap_content">
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
<TextView
|
202
|
-
|
203
|
-
android:id="@+id/result"
|
204
|
-
|
205
|
-
android:layout_width="match_parent"
|
206
|
-
|
207
|
-
android:layout_height="match_parent"
|
208
|
-
|
209
|
-
android:textIsSelectable="true" />
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
</LinearLayout>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
<RelativeLayout
|
222
|
-
|
223
|
-
android:layout_width="wrap_content"
|
224
|
-
|
225
|
-
android:layout_height="wrap_content"
|
226
|
-
|
227
|
-
android:layout_marginTop="30dp">
|
228
|
-
|
229
|
-
<Button
|
230
|
-
|
231
|
-
android:id="@+id/buttonclear"
|
232
|
-
|
233
|
-
android:layout_width="105dp"
|
234
|
-
|
235
|
-
android:layout_height="wrap_content"
|
236
|
-
|
237
|
-
android:layout_weight="1"
|
238
|
-
|
239
|
-
android:text="C"/>
|
240
|
-
|
241
|
-
<Button
|
242
|
-
|
243
|
-
android:id="@+id/buttonnotax"
|
244
|
-
|
245
|
-
android:layout_width="105dp"
|
246
|
-
|
247
|
-
android:layout_height="wrap_content"
|
248
|
-
|
249
|
-
android:layout_weight="1"
|
250
|
-
|
251
|
-
android:text="税抜"
|
252
|
-
|
253
|
-
android:layout_toRightOf="@+id/buttonclear"/>
|
254
|
-
|
255
|
-
<Button
|
256
|
-
|
257
|
-
android:id="@+id/buttontax"
|
258
|
-
|
259
|
-
android:layout_width="105dp"
|
260
|
-
|
261
|
-
android:layout_height="wrap_content"
|
262
|
-
|
263
|
-
android:layout_weight="1"
|
264
|
-
|
265
|
-
android:text="税込"
|
266
|
-
|
267
|
-
android:layout_toRightOf="@+id/buttonnotax"/>
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
<Button
|
272
|
-
|
273
|
-
android:id="@+id/buttondivide"
|
274
|
-
|
275
|
-
android:layout_width="105dp"
|
276
|
-
|
277
|
-
android:layout_height="wrap_content"
|
278
|
-
|
279
|
-
android:layout_weight="1"
|
280
|
-
|
281
|
-
android:text="÷"
|
282
|
-
|
283
|
-
android:layout_toRightOf="@+id/buttontax"/>
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
<Button
|
290
|
-
|
291
|
-
android:id="@+id/button7"
|
292
|
-
|
293
|
-
android:layout_width="105dp"
|
294
|
-
|
295
|
-
android:layout_height="wrap_content"
|
296
|
-
|
297
|
-
android:layout_weight="1"
|
298
|
-
|
299
|
-
android:layout_below="@+id/buttonclear"
|
300
|
-
|
301
|
-
android:text="7"/>
|
302
|
-
|
303
|
-
<Button
|
304
|
-
|
305
|
-
android:id="@+id/button8"
|
306
|
-
|
307
|
-
android:layout_width="105dp"
|
308
|
-
|
309
|
-
android:layout_height="wrap_content"
|
310
|
-
|
311
|
-
android:layout_weight="1"
|
312
|
-
|
313
|
-
android:text="8"
|
314
|
-
|
315
|
-
android:layout_below="@+id/buttonnotax"
|
316
|
-
|
317
|
-
android:layout_toRightOf="@+id/button7"/>
|
318
|
-
|
319
|
-
<Button
|
320
|
-
|
321
|
-
android:id="@+id/button9"
|
322
|
-
|
323
|
-
android:layout_width="105dp"
|
324
|
-
|
325
|
-
android:layout_height="wrap_content"
|
326
|
-
|
327
|
-
android:layout_weight="1"
|
328
|
-
|
329
|
-
android:text="9"
|
330
|
-
|
331
|
-
android:layout_below="@+id/buttontax"
|
332
|
-
|
333
|
-
android:layout_toRightOf="@+id/button8"/>
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
<Button
|
338
|
-
|
339
|
-
android:id="@+id/buttontimes"
|
340
|
-
|
341
|
-
android:layout_width="105dp"
|
342
|
-
|
343
|
-
android:layout_height="wrap_content"
|
344
|
-
|
345
|
-
android:layout_weight="1"
|
346
|
-
|
347
|
-
android:text="×"
|
348
|
-
|
349
|
-
android:layout_below="@+id/buttondivide"
|
350
|
-
|
351
|
-
android:layout_toRightOf="@+id/button9"/>
|
352
|
-
|
353
|
-
<Button
|
354
|
-
|
355
|
-
android:id="@+id/button4"
|
356
|
-
|
357
|
-
android:layout_width="105dp"
|
358
|
-
|
359
|
-
android:layout_height="wrap_content"
|
360
|
-
|
361
|
-
android:layout_weight="1"
|
362
|
-
|
363
|
-
android:text="4"
|
364
|
-
|
365
|
-
android:layout_below="@+id/button7"/>
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
<Button
|
370
|
-
|
371
|
-
android:id="@+id/button5"
|
372
|
-
|
373
|
-
android:layout_width="105dp"
|
374
|
-
|
375
|
-
android:layout_height="wrap_content"
|
376
|
-
|
377
|
-
android:layout_weight="1"
|
378
|
-
|
379
|
-
android:text="5"
|
380
|
-
|
381
|
-
android:layout_toRightOf="@+id/button4"
|
382
|
-
|
383
|
-
android:layout_below="@+id/button8"/>
|
384
|
-
|
385
|
-
<Button
|
386
|
-
|
387
|
-
android:id="@+id/button6"
|
388
|
-
|
389
|
-
android:layout_width="105dp"
|
390
|
-
|
391
|
-
android:layout_height="wrap_content"
|
392
|
-
|
393
|
-
android:layout_weight="1"
|
394
|
-
|
395
|
-
android:text="6"
|
396
|
-
|
397
|
-
android:layout_toRightOf="@+id/button5"
|
398
|
-
|
399
|
-
android:layout_below="@+id/button9"/>
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
<Button
|
404
|
-
|
405
|
-
android:id="@+id/buttonminus"
|
406
|
-
|
407
|
-
android:layout_width="105dp"
|
408
|
-
|
409
|
-
android:layout_height="wrap_content"
|
410
|
-
|
411
|
-
android:layout_weight="1"
|
412
|
-
|
413
|
-
android:text="-"
|
414
|
-
|
415
|
-
android:layout_toRightOf="@+id/button6"
|
416
|
-
|
417
|
-
android:layout_below="@+id/buttontimes"/>
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
<Button
|
422
|
-
|
423
|
-
android:id="@+id/button1"
|
424
|
-
|
425
|
-
android:layout_width="105dp"
|
426
|
-
|
427
|
-
android:layout_height="wrap_content"
|
428
|
-
|
429
|
-
android:layout_weight="1"
|
430
|
-
|
431
|
-
android:text="1"
|
432
|
-
|
433
|
-
android:layout_below="@+id/button4"/>
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
<Button
|
438
|
-
|
439
|
-
android:id="@+id/button2"
|
440
|
-
|
441
|
-
android:layout_width="105dp"
|
442
|
-
|
443
|
-
android:layout_height="wrap_content"
|
444
|
-
|
445
|
-
android:layout_weight="1"
|
446
|
-
|
447
|
-
android:text="2"
|
448
|
-
|
449
|
-
android:layout_toRightOf="@+id/button1"
|
450
|
-
|
451
|
-
android:layout_below="@+id/button4"/>
|
452
|
-
|
453
|
-
<Button
|
454
|
-
|
455
|
-
android:id="@+id/button3"
|
456
|
-
|
457
|
-
android:layout_width="105dp"
|
458
|
-
|
459
|
-
android:layout_height="wrap_content"
|
460
|
-
|
461
|
-
android:layout_weight="1"
|
462
|
-
|
463
|
-
android:text="3"
|
464
|
-
|
465
|
-
android:layout_toRightOf="@+id/button2"
|
466
|
-
|
467
|
-
android:layout_below="@+id/button6"/>
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
<Button
|
472
|
-
|
473
|
-
android:id="@+id/buttonplus"
|
474
|
-
|
475
|
-
android:layout_width="105dp"
|
476
|
-
|
477
|
-
android:layout_height="95dp"
|
478
|
-
|
479
|
-
android:layout_weight="1"
|
480
|
-
|
481
|
-
android:text="+"
|
482
|
-
|
483
|
-
android:layout_toRightOf="@+id/button3"
|
484
|
-
|
485
|
-
android:layout_below="@+id/buttonminus"/>
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
<Button
|
490
|
-
|
491
|
-
android:id="@+id/button0"
|
492
|
-
|
493
|
-
android:layout_width="105dp"
|
494
|
-
|
495
|
-
android:layout_height="wrap_content"
|
496
|
-
|
497
|
-
android:layout_weight="1"
|
498
|
-
|
499
|
-
android:text="0"
|
500
|
-
|
501
|
-
android:layout_below="@+id/button1"/>
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
<Button
|
506
|
-
|
507
|
-
android:id="@+id/buttondot"
|
508
|
-
|
509
|
-
android:layout_width="105dp"
|
510
|
-
|
511
|
-
android:layout_height="wrap_content"
|
512
|
-
|
513
|
-
android:layout_weight="1"
|
514
|
-
|
515
|
-
android:text="."
|
516
|
-
|
517
|
-
android:layout_toRightOf="@+id/button0"
|
518
|
-
|
519
|
-
android:layout_below="@+id/button1"/>
|
520
|
-
|
521
|
-
<Button
|
522
|
-
|
523
|
-
android:id="@+id/buttonequal"
|
524
|
-
|
525
|
-
android:layout_width="105dp"
|
526
|
-
|
527
|
-
android:layout_height="wrap_content"
|
528
|
-
|
529
|
-
android:layout_weight="1"
|
530
|
-
|
531
|
-
android:text="="
|
532
|
-
|
533
|
-
android:layout_toRightOf="@+id/buttondot"
|
534
|
-
|
535
|
-
android:layout_below="@+id/button1"/>
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
<TextView
|
540
|
-
|
541
|
-
android:layout_width="137dp"
|
542
|
-
|
543
|
-
android:layout_height="wrap_content"
|
544
|
-
|
545
|
-
android:layout_below="@+id/button0"
|
546
|
-
|
547
|
-
android:text="履歴"/>
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
</RelativeLayout>
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
</RelativeLayout>
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
```
|