質問編集履歴
1
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -47,4 +47,141 @@
|
|
47
47
|
```error
|
48
48
|
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Switch.setOnCheckedChangeListener(android.widget.CompoundButton$OnCheckedChangeListener)' on a null object reference
|
49
49
|
at com.example.a162105.kakeibo.InputIncome.onCreate(InputIncome.java:128)
|
50
|
+
```
|
51
|
+
```Java
|
52
|
+
InputIncome Layout
|
53
|
+
<?xml version="1.0" encoding="utf-8"?>
|
54
|
+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
55
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
56
|
+
xmlns:tools="http://schemas.android.com/tools"
|
57
|
+
android:id="@+id/container"
|
58
|
+
android:layout_width="match_parent"
|
59
|
+
android:layout_height="match_parent"
|
60
|
+
tools:context=".Input">
|
61
|
+
|
62
|
+
|
63
|
+
<android.support.design.widget.BottomNavigationView
|
64
|
+
android:id="@+id/navigation"
|
65
|
+
android:layout_width="0dp"
|
66
|
+
android:layout_height="wrap_content"
|
67
|
+
android:layout_marginStart="0dp"
|
68
|
+
android:layout_marginEnd="0dp"
|
69
|
+
android:background="?android:attr/windowBackground"
|
70
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
71
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
72
|
+
app:layout_constraintRight_toRightOf="parent"
|
73
|
+
app:menu="@menu/navigation" />
|
74
|
+
|
75
|
+
<Button
|
76
|
+
android:id="@+id/addbutton"
|
77
|
+
style="@style/Widget.AppCompat.Button.Colored"
|
78
|
+
android:layout_width="wrap_content"
|
79
|
+
android:layout_height="wrap_content"
|
80
|
+
android:layout_marginStart="8dp"
|
81
|
+
android:layout_marginLeft="8dp"
|
82
|
+
android:layout_marginTop="8dp"
|
83
|
+
android:layout_marginEnd="8dp"
|
84
|
+
android:layout_marginRight="8dp"
|
85
|
+
android:layout_marginBottom="8dp"
|
86
|
+
android:text="追加"
|
87
|
+
android:onClick="onClickAddButton"
|
88
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
89
|
+
app:layout_constraintEnd_toEndOf="parent"
|
90
|
+
app:layout_constraintHorizontal_bias="0.971"
|
91
|
+
app:layout_constraintStart_toStartOf="parent"
|
92
|
+
app:layout_constraintTop_toTopOf="parent"
|
93
|
+
app:layout_constraintVertical_bias="0.879" />
|
94
|
+
|
95
|
+
<TextView
|
96
|
+
android:id="@+id/textView"
|
97
|
+
android:layout_width="wrap_content"
|
98
|
+
android:layout_height="wrap_content"
|
99
|
+
android:layout_marginStart="8dp"
|
100
|
+
android:layout_marginLeft="8dp"
|
101
|
+
android:layout_marginTop="16dp"
|
102
|
+
android:layout_marginEnd="8dp"
|
103
|
+
android:layout_marginRight="8dp"
|
104
|
+
android:layout_marginBottom="8dp"
|
105
|
+
android:text="金額"
|
106
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
107
|
+
app:layout_constraintEnd_toEndOf="parent"
|
108
|
+
app:layout_constraintHorizontal_bias="0.0"
|
109
|
+
app:layout_constraintStart_toStartOf="parent"
|
110
|
+
app:layout_constraintTop_toTopOf="parent"
|
111
|
+
app:layout_constraintVertical_bias="0.0" />
|
112
|
+
|
113
|
+
<TextView
|
114
|
+
android:id="@+id/textView2"
|
115
|
+
android:layout_width="75dp"
|
116
|
+
android:layout_height="22dp"
|
117
|
+
android:layout_marginStart="8dp"
|
118
|
+
android:layout_marginLeft="8dp"
|
119
|
+
android:layout_marginTop="8dp"
|
120
|
+
android:layout_marginEnd="8dp"
|
121
|
+
android:layout_marginRight="8dp"
|
122
|
+
android:layout_marginBottom="8dp"
|
123
|
+
android:text="カテゴリー"
|
124
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
125
|
+
app:layout_constraintEnd_toEndOf="parent"
|
126
|
+
app:layout_constraintHorizontal_bias="0.0"
|
127
|
+
app:layout_constraintStart_toStartOf="parent"
|
128
|
+
app:layout_constraintTop_toBottomOf="@+id/textView"
|
129
|
+
app:layout_constraintVertical_bias="0.307" />
|
130
|
+
|
131
|
+
<TextView
|
132
|
+
android:id="@+id/textView3"
|
133
|
+
android:layout_width="wrap_content"
|
134
|
+
android:layout_height="wrap_content"
|
135
|
+
android:layout_marginStart="8dp"
|
136
|
+
android:layout_marginLeft="8dp"
|
137
|
+
android:layout_marginTop="44dp"
|
138
|
+
android:layout_marginEnd="8dp"
|
139
|
+
android:layout_marginRight="8dp"
|
140
|
+
android:layout_marginBottom="8dp"
|
141
|
+
android:text="メモ"
|
142
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
143
|
+
app:layout_constraintEnd_toEndOf="parent"
|
144
|
+
app:layout_constraintHorizontal_bias="0.023"
|
145
|
+
app:layout_constraintStart_toStartOf="parent"
|
146
|
+
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
147
|
+
app:layout_constraintVertical_bias="0.008" />
|
148
|
+
|
149
|
+
<TextView
|
150
|
+
android:id="@+id/textView4"
|
151
|
+
android:layout_width="wrap_content"
|
152
|
+
android:layout_height="wrap_content"
|
153
|
+
android:layout_marginStart="8dp"
|
154
|
+
android:layout_marginLeft="8dp"
|
155
|
+
android:layout_marginTop="48dp"
|
156
|
+
android:layout_marginEnd="8dp"
|
157
|
+
android:layout_marginRight="8dp"
|
158
|
+
android:layout_marginBottom="8dp"
|
159
|
+
android:text="日付"
|
160
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
161
|
+
app:layout_constraintEnd_toEndOf="parent"
|
162
|
+
app:layout_constraintHorizontal_bias="0.023"
|
163
|
+
app:layout_constraintStart_toStartOf="parent"
|
164
|
+
app:layout_constraintTop_toBottomOf="@+id/textView3"
|
165
|
+
app:layout_constraintVertical_bias="0.023" />
|
166
|
+
|
167
|
+
<Switch
|
168
|
+
android:id="@+id/IncomeSwitch"
|
169
|
+
android:layout_width="wrap_content"
|
170
|
+
android:layout_height="30dp"
|
171
|
+
android:layout_marginStart="8dp"
|
172
|
+
android:layout_marginLeft="8dp"
|
173
|
+
android:layout_marginTop="8dp"
|
174
|
+
android:layout_marginEnd="8dp"
|
175
|
+
android:layout_marginRight="8dp"
|
176
|
+
android:layout_marginBottom="8dp"
|
177
|
+
android:switchTextAppearance="@style/TextAppearance.AppCompat.Caption"
|
178
|
+
android:text="Switch"
|
179
|
+
app:layout_constraintBottom_toBottomOf="@+id/navigation"
|
180
|
+
app:layout_constraintEnd_toEndOf="parent"
|
181
|
+
app:layout_constraintHorizontal_bias="0.539"
|
182
|
+
app:layout_constraintStart_toStartOf="parent"
|
183
|
+
app:layout_constraintTop_toTopOf="parent"
|
184
|
+
app:layout_constraintVertical_bias="0.0" />
|
185
|
+
|
186
|
+
</android.support.constraint.ConstraintLayout>
|
50
187
|
```
|