- なぜ私たちはアンドロイドでインフレータを使用する必要があるのかについてあいまいさがありました。なぜカスタムレイアウト(以下同様)でListViewで使用されますか?
- インフレータとは何ですか?
- Inflaterを使用する利点は何ですか?
public class MobileArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] values;
public MobileArrayAdapter(Context context, String[] values) {
super(context, R.layout.list_mobile, values);
this.context = context;
this.values = values;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.list_mobile, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
textView.setText(values[position]);
彼らはカスタムレイアウト用のAndroidのListViewで使用されているのはなぜおかげで、なぜリストビューでInflaterを使用するのですか?
"利点はありません。何らかの方法でビューを膨らませる必要があります"そのステートメントは明らかに間違っています。コード –
でビューを作成することができます。 – Joel
「Inflaterを使用する利点は何ですか? "私はInflaterを使用してコードをビューに作成する利点は何ですか?"あなたの答え「それを使用する利点はありません[...]」は、「拡張された」質問に答えると間違っています。 –