Extended LinearLayout with tablelayer

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

Extended LinearLayout with tablelayer

Postby Ventrix » Fri Jan 09, 2009 4:42 pm

I want to create a list with multiple tablelayout.
On the left column there will be a picture, while on the right column will be another table, with two rows, one for the name and one for the surname.

So, my layout xml is this:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/widget45"
   android:layout_width="fill_parent" android:layout_height="fill_parent"
   android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
   <ListView android:id="@+id/listv1" android:layout_width="fill_parent"
      android:gravity="center_vertical" android:layout_height="wrap_content">
      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="fill_parent" android:layout_height="fill_parent">
         <TableRow>
            <ImageView android:layout_width="wrap_content"
               android:layout_height="wrap_content" android:layout_gravity="center_horizontal">
            </ImageView>
            <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="fill_parent" android:layout_height="fill_parent">
               <TableRow>
                  <TextView android:layout_width="fill_parent"
                     android:layout_height="wrap_content" />
               </TableRow>
               <TableRow>
                  <TextView android:layout_width="fill_parent"
                     android:layout_height="wrap_content" />
               </TableRow>
            </TableLayout>
         </TableRow>
      </TableLayout>
   </ListView>
</LinearLayout>


The adapter is ready,
Code: Select all
...
   public View getView(int position, View convertView, ViewGroup parent) {
      IconifiedTextView btv;
      if (convertView == null) {
         btv = new IconifiedTextView(mContext, mItems.get(position));
      } else { // Reuse/Overwrite the View passed
         // We are assuming(!) that it is castable!
         btv = (IconifiedTextView) convertView;
         btv.setText(mItems.get(position).getText());
         btv.setIcon(mItems.get(position).getIcon());
         btv.setSecText(" "+mItems.get(position).getSecText());
      }
      return btv;
   }
...

but I do not know how to create the View to be displayed properly on the layout I designed (IconifiedTextView).
http://www.androidgreece.gr - Greek Android Community
User avatar
Ventrix
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Mar 04, 2008 11:47 pm
Location: Greece

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 9 guests