質問編集履歴

2

mainlist.xmlを更新しました

2019/03/08 16:05

投稿

taro_yamada
taro_yamada

スコア55

test CHANGED
File without changes
test CHANGED
@@ -112,60 +112,254 @@
112
112
 
113
113
 
114
114
 
115
- ```fragment_manage.xml
116
-
117
- <?xml version="1.0" encoding="utf-8"?>
118
-
119
- <android.support.constraint.ConstraintLayout
120
-
121
- xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
122
-
123
- android:layout_height="match_parent">
124
-
125
- <RelativeLayout
126
-
127
- android:layout_margin="10dp"
128
-
129
- android:layout_width="match_parent"
130
-
131
- android:layout_height="match_parent"
132
-
133
- android:background="@drawable/fragment_bg">
134
-
135
-
136
-
137
- <ListView
138
-
139
- android:id="@+id/main_listview"
140
-
141
- android:layout_width="wrap_content"
142
-
143
- android:layout_height="wrap_content"
144
-
145
- android:layout_alignParentTop="true"
146
-
147
- android:layout_alignParentEnd="true"
148
-
149
- android:layout_alignParentBottom="true"
150
-
151
- android:layout_marginTop="0dp"
152
-
153
- android:layout_marginEnd="0dp"
154
-
155
- android:layout_marginBottom="0dp"
156
-
157
- android:padding="10dp"
158
-
159
- android:clipToPadding="false">
160
-
161
-
162
-
163
- </ListView>
164
-
165
- </RelativeLayout>
166
-
167
-
168
-
169
- </android.support.constraint.ConstraintLayout>
115
+ ```maillist.xml
116
+
117
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
118
+
119
+ xmlns:tools="http://schemas.android.com/tools"
120
+
121
+ android:layout_width="match_parent"
122
+
123
+ android:layout_height="90dp"
124
+
125
+ android:orientation="horizontal">
126
+
127
+
128
+
129
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
130
+
131
+ android:layout_width="300dp"
132
+
133
+ android:layout_height="90dp"
134
+
135
+ android:orientation="vertical"
136
+
137
+ android:paddingTop="10dp"
138
+
139
+ android:paddingBottom="10dp"
140
+
141
+ android:background="@color/white_color">
142
+
143
+
144
+
145
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
146
+
147
+ android:id="@+id/layout1"
148
+
149
+ android:layout_width="match_parent"
150
+
151
+ android:layout_height="20dp"
152
+
153
+ android:layout_gravity="top"
154
+
155
+ android:orientation="horizontal">
156
+
157
+
158
+
159
+ <TextView
160
+
161
+ android:id="@+id/meigaraText"
162
+
163
+ android:layout_width="wrap_content"
164
+
165
+ android:layout_height="wrap_content"
166
+
167
+ android:text="@string/meigaracode"
168
+
169
+ android:textAppearance="?android:attr/textAppearanceSmall" />
170
+
171
+
172
+
173
+ <TextView
174
+
175
+ android:id="@+id/companynameText"
176
+
177
+ android:layout_width="match_parent"
178
+
179
+ android:layout_height="wrap_content"
180
+
181
+ android:text="@string/companyname"
182
+
183
+ android:textAppearance="?android:attr/textAppearanceMedium"
184
+
185
+ tools:textSize="14sp" />
186
+
187
+
188
+
189
+ </LinearLayout>
190
+
191
+
192
+
193
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
194
+
195
+ android:id="@+id/layout2"
196
+
197
+ android:layout_width="match_parent"
198
+
199
+ android:layout_height="20dp"
200
+
201
+ android:layout_gravity="center"
202
+
203
+ android:orientation="horizontal">
204
+
205
+
206
+
207
+ <TextView
208
+
209
+ android:id="@+id/period"
210
+
211
+ android:layout_width="wrap_content"
212
+
213
+ android:layout_height="wrap_content"
214
+
215
+ android:layout_gravity="center_vertical"
216
+
217
+ android:text="BB期間:"
218
+
219
+ android:textAppearance="?android:attr/textAppearanceMedium"
220
+
221
+ android:textSize="12sp" />
222
+
223
+
224
+
225
+ <TextView
226
+
227
+ android:id="@+id/bbStart"
228
+
229
+ android:layout_width="wrap_content"
230
+
231
+ android:layout_height="wrap_content"
232
+
233
+ android:layout_gravity="center_vertical"
234
+
235
+ android:text="@string/bbstart"
236
+
237
+ android:textAppearance="?android:attr/textAppearanceMedium"
238
+
239
+ android:textSize="12sp" />
240
+
241
+
242
+
243
+ <TextView
244
+
245
+ android:id="@+id/period"
246
+
247
+ android:layout_width="wrap_content"
248
+
249
+ android:layout_height="wrap_content"
250
+
251
+ android:layout_gravity="center_vertical"
252
+
253
+ android:text=" から "
254
+
255
+ android:textAppearance="?android:attr/textAppearanceMedium"
256
+
257
+ android:textSize="12sp" />
258
+
259
+
260
+
261
+ <TextView
262
+
263
+ android:id="@+id/bbEnd"
264
+
265
+ android:layout_width="wrap_content"
266
+
267
+ android:layout_height="wrap_content"
268
+
269
+ android:layout_gravity="center_vertical"
270
+
271
+ android:text="@string/bbend"
272
+
273
+ android:textAppearance="?android:attr/textAppearanceMedium"
274
+
275
+ android:textSize="12sp" />
276
+
277
+
278
+
279
+
280
+
281
+ </LinearLayout>
282
+
283
+
284
+
285
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
286
+
287
+ android:id="@+id/layout3"
288
+
289
+ android:layout_width="match_parent"
290
+
291
+ android:layout_height="20dp"
292
+
293
+ android:layout_gravity="bottom"
294
+
295
+ android:orientation="horizontal">
296
+
297
+
298
+
299
+ <TextView
300
+
301
+ android:id="@+id/yosocaption"
302
+
303
+ android:layout_width="wrap_content"
304
+
305
+ android:layout_height="wrap_content"
306
+
307
+ android:layout_gravity="center_vertical|end"
308
+
309
+ android:text="予想初値"
310
+
311
+ android:textAppearance="?android:attr/textAppearanceMedium"
312
+
313
+ android:textSize="12sp" />
314
+
315
+
316
+
317
+ <TextView
318
+
319
+ android:id="@+id/yosoKabuka"
320
+
321
+ android:layout_width="wrap_content"
322
+
323
+ android:layout_height="wrap_content"
324
+
325
+ android:layout_gravity="center_vertical|end"
326
+
327
+ android:text="@string/yosokabuka"
328
+
329
+ android:textAppearance="?android:attr/textAppearanceMedium"
330
+
331
+ android:textSize="12sp" />
332
+
333
+
334
+
335
+ </LinearLayout>
336
+
337
+
338
+
339
+
340
+
341
+ </LinearLayout>
342
+
343
+
344
+
345
+ <Button
346
+
347
+ android:id="@+id/button1"
348
+
349
+ style="@style/Widget.AppCompat.Button"
350
+
351
+ android:layout_width="0dp"
352
+
353
+ android:layout_height="30dp"
354
+
355
+ android:layout_weight="2"
356
+
357
+ android:layout_gravity="center"
358
+
359
+ android:text="@string/button" />
360
+
361
+
362
+
363
+ </LinearLayout>
170
364
 
171
365
  ```

1

getViewとxmlを追記しました。

2019/03/08 16:05

投稿

taro_yamada
taro_yamada

スコア55

test CHANGED
File without changes
test CHANGED
@@ -49,3 +49,123 @@
49
49
  }
50
50
 
51
51
  ```
52
+
53
+
54
+
55
+
56
+
57
+ ```getView
58
+
59
+ @Override
60
+
61
+ public View getView(int position, View convertView, ViewGroup parent){
62
+
63
+
64
+
65
+ ViewHolder viewHolder;
66
+
67
+ if(convertView == null){
68
+
69
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
70
+
71
+ convertView = inflater.inflate(R.layout.mainlist, parent, false);
72
+
73
+ viewHolder = new ViewHolder();
74
+
75
+ viewHolder.meigaracode = (TextView)convertView.findViewById(R.id.meigaraText);
76
+
77
+ viewHolder.companyname = (TextView)convertView.findViewById(R.id.companynameText);
78
+
79
+ viewHolder.bbstart = (TextView)convertView.findViewById(R.id.bbStart);
80
+
81
+ viewHolder.bbend = (TextView)convertView.findViewById(R.id.bbEnd);
82
+
83
+ viewHolder.yosokakaku = (TextView)convertView.findViewById(R.id.yosoKabuka);
84
+
85
+
86
+
87
+ convertView.setTag(viewHolder);
88
+
89
+ } else {
90
+
91
+ viewHolder = (ViewHolder)convertView.getTag();
92
+
93
+ }
94
+
95
+ MainList item = (MainList)getItem(position);
96
+
97
+ viewHolder.bbstart.setText(item.getBbstart());
98
+
99
+ viewHolder.bbend.setText(item.getBbend());
100
+
101
+ viewHolder.meigaracode.setText(item.getMeigaracode());
102
+
103
+ viewHolder.companyname.setText(item.getCompanyname());
104
+
105
+ return convertView;
106
+
107
+ }
108
+
109
+
110
+
111
+ ```
112
+
113
+
114
+
115
+ ```fragment_manage.xml
116
+
117
+ <?xml version="1.0" encoding="utf-8"?>
118
+
119
+ <android.support.constraint.ConstraintLayout
120
+
121
+ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
122
+
123
+ android:layout_height="match_parent">
124
+
125
+ <RelativeLayout
126
+
127
+ android:layout_margin="10dp"
128
+
129
+ android:layout_width="match_parent"
130
+
131
+ android:layout_height="match_parent"
132
+
133
+ android:background="@drawable/fragment_bg">
134
+
135
+
136
+
137
+ <ListView
138
+
139
+ android:id="@+id/main_listview"
140
+
141
+ android:layout_width="wrap_content"
142
+
143
+ android:layout_height="wrap_content"
144
+
145
+ android:layout_alignParentTop="true"
146
+
147
+ android:layout_alignParentEnd="true"
148
+
149
+ android:layout_alignParentBottom="true"
150
+
151
+ android:layout_marginTop="0dp"
152
+
153
+ android:layout_marginEnd="0dp"
154
+
155
+ android:layout_marginBottom="0dp"
156
+
157
+ android:padding="10dp"
158
+
159
+ android:clipToPadding="false">
160
+
161
+
162
+
163
+ </ListView>
164
+
165
+ </RelativeLayout>
166
+
167
+
168
+
169
+ </android.support.constraint.ConstraintLayout>
170
+
171
+ ```