TextView und Button in setEmptyView

M

muck

Ambitioniertes Mitglied
7
Hallo zusammen,
wenn mein SimpleCursorAdapter leer ist, also kein Ergbins aus der DB-Abfrage kommt möchte ich über setEmptyView ein TextView zusammenm mit einem Button anzeigen. Jedes einzel funktioniert wie bekomm ich das zusammen? Der Aufruf:
Code:
[SIZE=2]SimpleCursorAdapter productListAdapter = [/SIZE]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] SimpleCursorAdapter ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]simple_list_item_1[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], productList, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String[] {[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"name"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]}, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][] {R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]text1[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]});[/SIZE]
[SIZE=2]setListAdapter(productListAdapter);[/SIZE][/LEFT]

Das Layout dazu:​
HTML:
[LEFT][LEFT]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#A0FFF7"
android:cacheColorHint="#FF0000"
/>
<TextView
android:id="@+id/noteEmptyList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="25px"
android:paddingLeft="20px"
android:background="#A0FFF7"
android:text="@string/txt_emptyList"
android:visibility="gone"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/btn_emptyList"
/>[/LEFT]
</LinearLayout>
[/LEFT]

Wahscheinlich ist es recht simpel, ich komm aber nicht drauf.​

Im Voraus vielen Dank.
Gruß​
 
Leg einfach ein LinearLayout um TextView und Button und weise dieses LinearLayout dann mit setEmptyView zu. Müsste so funktionieren. ;)
 
  • Danke
Reaktionen: muck
Jo Danke, wie einfach doch manchmal die Welt sein kann :smile:
 

Ähnliche Themen

A
  • AnimaAngelo85
Antworten
1
Aufrufe
313
swa00
swa00
MES
Antworten
10
Aufrufe
787
MES
MES
A
Antworten
3
Aufrufe
674
swa00
swa00
Zurück
Oben Unten