S
spike
Neues Mitglied
- 0
Hi zusammen,
ich würde gerne eine ListView in einem Dialog darstellen, in der pro Zeile auch ein Image angezeigt wird. Bisher setze ich nur TextView - Werte mit Inhalten aus meinem Cursor. Mein Cursor enthält aber ebenfalls noch Pfade zu meinen Images, die ich gerne setzen möchte. Nur habe ich keinen Plan wie man Images in einer ListView in einem Dialog setzen kann. Anbei noch etwas Code.
Viele Grüße
Spike
ich würde gerne eine ListView in einem Dialog darstellen, in der pro Zeile auch ein Image angezeigt wird. Bisher setze ich nur TextView - Werte mit Inhalten aus meinem Cursor. Mein Cursor enthält aber ebenfalls noch Pfade zu meinen Images, die ich gerne setzen möchte. Nur habe ich keinen Plan wie man Images in einer ListView in einem Dialog setzen kann. Anbei noch etwas Code.
Code:
[SIZE=2][LEFT]Dialog dialog = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Dialog([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
AlertDialog.Builder builder = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] AlertDialog.Builder([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
builder.setTitle(R.string.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tx_loeschen_dialog_titel[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
ListView modeList = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ListView([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
ArrayList<String> list = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ArrayList<String>();
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cursor[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].moveToFirst();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]while[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](![/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cursor[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].isLast()){
list.add([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cursor[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getString(1));
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cursor[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].moveToNext();
}
ArrayAdapter<String> modeAdapter = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ArrayAdapter<String>([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]loeschen_liste[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tx_loeschen_beschreibung[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], list);
modeList.setAdapter(modeAdapter);
builder.setView(modeList);
dialog = builder.create(); [/LEFT]
dialog.show(); [/SIZE]
Viele Grüße
Spike