質問編集履歴

3

訂正

2017/10/12 06:45

投稿

S.I
S.I

スコア48

test CHANGED
File without changes
test CHANGED
@@ -24,6 +24,36 @@
24
24
 
25
25
 
26
26
 
27
+
28
+
29
+ <com.example.nakahara.game.MyView
30
+
31
+ android:id="@+id/view"
32
+
33
+ android:layout_width="0dp"
34
+
35
+ android:layout_height="0dp"
36
+
37
+ android:layout_marginBottom="16dp"
38
+
39
+ android:layout_marginLeft="16dp"
40
+
41
+ android:layout_marginRight="16dp"
42
+
43
+ android:layout_marginTop="16dp"
44
+
45
+ app:layout_constraintBottom_toBottomOf="parent"
46
+
47
+ app:layout_constraintLeft_toLeftOf="parent"
48
+
49
+ app:layout_constraintRight_toRightOf="parent"
50
+
51
+ app:layout_constraintTop_toTopOf="parent"
52
+
53
+ app:layout_constraintHorizontal_bias="0.0"
54
+
55
+ app:layout_constraintVertical_bias="0.0" />
56
+
27
57
  </android.support.constraint.ConstraintLayout>
28
58
 
29
59
 
@@ -34,13 +64,11 @@
34
64
 
35
65
 
36
66
 
37
- MainActivity.java
67
+ MyView.java
38
68
 
39
69
  ```java
40
70
 
41
- package com.example.nakahara.game;
71
+ import android.content.Context;
42
-
43
-
44
72
 
45
73
  import android.graphics.Canvas;
46
74
 
@@ -52,33 +80,27 @@
52
80
 
53
81
  import android.graphics.RectF;
54
82
 
55
- import android.support.v7.app.AppCompatActivity;
56
-
57
- import android.os.Bundle;
83
+ import android.view.View;
58
84
 
59
85
 
60
86
 
61
- public class MainActivity extends AppCompatActivity {
87
+ public class MyView extends View {
88
+
89
+ public MyView(Context context) {
90
+
91
+ super(context);
92
+
93
+ }
62
94
 
63
95
 
64
96
 
65
97
  @Override
66
98
 
67
- protected void onCreate(Bundle savedInstanceState) {
68
-
69
- super.onCreate(savedInstanceState);
70
-
71
- setContentView(R.layout.activity_main);
72
-
73
- }
74
-
75
-
76
-
77
99
  protected void onDraw(Canvas canvas) {
78
100
 
79
101
  Paint paint = new Paint();
80
102
 
81
- paint.setColor(Color.argb(255, 255, 255, 255));
103
+ paint.setColor(Color.argb(255, 0, 0, 0));
82
104
 
83
105
 
84
106
 
@@ -100,12 +122,10 @@
100
122
 
101
123
  }
102
124
 
125
+ }
103
126
 
104
127
 
105
128
 
106
129
 
107
- }
108
-
109
-
110
130
 
111
131
  ```

2

誤字

2017/10/12 06:45

投稿

S.I
S.I

スコア48

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- androidstudioのメイン画面で形を描写しようと思っているのですが、Design画面に表示されません。androidstudio上では、MainActivity.javaのコードの19行目onDrawという文字の色がグレーになっており認識されません........ちなみに、エラーメッセージは出ません。
1
+ androidstudioのメイン画面で形を描写しようと思っているのですが、Design画面に表示されません。androidstudio上では、MainActivity.javaのコードの19行目onDrawという文字の色がグレーになっており認識されません........ちなみに、エラーメッセージは出ません。
2
2
 
3
3
 
4
4
 

1

誤字

2017/10/12 05:38

投稿

S.I
S.I

スコア48

test CHANGED
@@ -1 +1 @@
1
- 形(Rect)を描写
1
+ 形(Rect)を描写
test CHANGED
File without changes