Having trouble converting XML layout to java

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Having trouble converting XML layout to java

Postby greggee » Tue Jul 21, 2009 7:24 pm

Wondering if someone could show me the proper way to do this in code. I keep trying, but just can't figure it out. This is my first attempt at an android app, so go easy on me. My main problem has been with the layout params. I can only get some to work or my app crashes. Assistance with solving this mystery for me would be greatly appreciated.

I first created this in XML to get the layout I want, but now trying to convert to java so it can be data filled from DB.

Thanks,
Greg

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <TableLayout android:stretchColumns="2,3,4"
  3.  
  4.                             android:layout_width="fill_parent"
  5.  
  6.                             android:layout_height="fill_parent"
  7.  
  8.                             >
  9.  
  10.                             <TableRow android:background="#848484" android:layout_margin="2dip">
  11.  
  12.                                 <TextView android:text="ID" android:background="#000000"/>
  13.  
  14.                                 <TextView android:text="Name" android:background="#000000" android:layout_margin="2dip"/>
  15.  
  16.                                 <TextView android:text="Number" android:background="#000000" android:layout_margin="2dip"/>
  17.  
  18.                                 <TextView android:text="Make" android:background="#000000" android:layout_margin="2dip"/>
  19.  
  20.                             </TableRow>
  21.  
  22.                             <View android:layout_height="2px" android:background="#0000FF"/>
  23.  
  24.                             <TableRow android:background="#848484" android:layout_margin="2dip">
  25.  
  26.                                 <TextView android:text="col1" android:background="#000000"/>
  27.  
  28.                                 <TextView android:text="col2" android:background="#000000"
  29.  
  30.                                 android:layout_margin="2dip" android:id="@+id/entry1_0"/>
  31.  
  32.                                 <TextView android:text="col3" android:background="#000000"
  33.  
  34.                                 android:layout_margin="2dip" android:id="@+id/entry1_1"/>
  35.  
  36.                                 <TextView android:text="col4" android:background="#000000"
  37.  
  38.                                 android:layout_margin="2dip" android:id="@+id/entry1_2"/>
  39.  
  40.                             </TableRow>
  41.  
  42.                         </TableLayout>
  43.  
  44.  
Parsed in 0.008 seconds, using GeSHi 1.0.8.4
greggee
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jul 21, 2009 7:13 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests