ListView android: I can't see my list items -
i'm trying show listview in android application. (i know i'm not extending of listactivity, can error?) code:
public class home extends activity{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); startlocation(); createmenutabs(); final string[] datos = new string[]{"lista 1","lista 2","lista 3","lista 4","lista 5"}; arrayadapter<string> adaptador = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, datos); listview urban_lines_list = (listview)findviewbyid(r.id.urban_lines_list); urban_lines_list.setadapter(adaptador); } }
the xml is:
<linearlayout android:id="@+id/urbano" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <textview android:id="@+id/urban_lines" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/list_of_lines"/> <listview android:id="@+id/urban_lines_list" android:layout_width="match_parent" android:layout_height="match_parent"/> </linearlayout>
thanks help!
your textview filling whole screen, change height wrap_content
.
<textview android:id="@+id/urban_lines" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/list_of_lines"/>
Comments
Post a Comment