import android.view.*; import android.widget.*; import android.content.*; sclass AndroidList { ListView lv; O onClick; View view() { ret lv; } *(L<S> l) { lv = new ListView(androidActivity()); lv.setAdapter(new MyAdapter(androidActivity (), toStringArray(l))); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) { callF(onClick, position); } }); } class MyAdapter extends ArrayAdapter<String> { public MyAdapter(Context context, String[] strings) { super(context, -1, -1, strings); } @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout listLayout = new LinearLayout(getContext ()); listLayout.setLayoutParams(new AbsListView.LayoutParams( AbsListView.LayoutParams.FILL_PARENT, AbsListView.LayoutParams.WRAP_CONTENT)); listLayout.setId(View.generateViewId()); TextView listText = new TextView(getContext()); listText.setId(View.generateViewId()); listLayout.addView(listText); listText.setText(super.getItem(position)); return listLayout; } } }
Began life as a copy of #1004466
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005315 |
Snippet name: | AndroidList - Android ListView with strings |
Eternal ID of this version: | #1005315/2 |
Text MD5: | 9eb5b1865c79a9221bd9d15547a4a85e |
Author: | stefan |
Category: | javax / android |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-19 12:27:35 |
Source code size: | 1420 bytes / 52 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 503 / 1071 |
Version history: | 1 change(s) |
Referenced in: | [show references] |