android - How to get two textviews in a listview on the same line? -


i have 2 textviews tva , tvb appear in listview lva. tva , tvb display data pulled sqlite database using cursor.

cursor cursor = mydb.getallrows();      string[] = new string[]                     {dbadapter.key_a,dbadapter.key_b};             int[] = new int[]                     {r.id.tva,r.id.tvb};      simplecursoradapter mycursoradapter =new simplecursoradapter(this,r.layout.lva, cursor,from,to);  mylist = (listview) findviewbyid(r.id.lva);         mylist.setadapter(mycursoradapter);         registerforcontextmenu(mylist); 

the issue tva , tvb doesn't appear 1 item in lva (i.e. don't appear on same line) , appear 2 different items.

below xml:

<?xml version="1.0" encoding="utf-8"?> <relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="?android:attr/listpreferreditemheight"     android:padding="5dip"     >      <textview         android:id="@+id/tva"         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:gravity="center_vertical"/>       <textview         android:id="@+id/tvb"         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:gravity="center_vertical"         android:layout_torightof="@id/tva"/>  </relativelayout> 

if want both textviews in same align can use linearlayout android:layout_weight attribute.

to have equal width textview, give same weight value.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -