android - TableLayout looks fine on emulator but not on device -



android - TableLayout looks fine on emulator but not on device -

i'm running code on emulator android 2.2 , works fine. when set on device (galaxy s 2.3.3) main screen should show list of elements in table - stays blank. toasts shown , header app_name

the table made of button (defined in xml) , list of elements loaded db.

main.xml

<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <tablelayout android:id="@+id/tablelayoutmain" android:layout_width="match_parent" android:layout_height="wrap_content"> <tablerow> <button android:text="@string/add_button" android:id="@+id/add_button" android:layout_height="wrap_content" android:layout_margintop="10dp" android:layout_marginbottom="10dp" android:layout_width="match_parent" android:layout_weight="1"></button> </tablerow> </tablelayout> </scrollview>

and here code:

public void showlist(cursor c){ setcontentview(r.layout.main); table = (tablelayout) findviewbyid(r.id.tablelayoutmain); { tablerow tr = new tablerow(this); final int id = c.getint(c.getcolumnindex(databaseadapter.key_rowid)); tr.setid(id); tr.setbackgroundcolor(row_color); tr.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view v) { //do stuff homecoming true; } }); tr.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { //do other stuff } }); textview txt = gettext(active, id, name); tr.addview(txt); table.addview(tr); } while (c.movetonext()); c.close(); }

i wasn't sure if mixing between xml definitions , programatically adding elements work. have tried various combinations , can both work as bad. i.e. fine on emulator , bad on device. have created virtual device android 2.3.3 code runs fine well... guess can't android version. thoughts?

done, got work using relative layout parent tablelayout. not wanted works...

android android-emulator tablelayout

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -