TableRow, ListView height

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

TableRow, ListView height

Postby williamzanelli » Wed Apr 29, 2009 6:20 pm

Hi guys,

I have a ListView, could some please tell me how to set the height for this..

Similar issue with TableRow, i need to set the hight, cant find the command.

Thanks in advance.
Will
williamzanelli
Experienced Developer
Experienced Developer
 
Posts: 63
Joined: Mon Jan 05, 2009 2:37 am
Location: UK

Top

Reply

Postby satishkumar_lskin » Sun May 03, 2009 11:11 am

Hi William,
For any View in Android , u should use setLayoutParams(int width, int height ) to set its dimensions. U can use this method for ur ListView and TableRow. Is this what u are looking for ?
satishkumar_lskin
Developer
Developer
 
Posts: 32
Joined: Mon Oct 20, 2008 8:15 am
Location: Coimbatore , TamilNadu, India

Postby williamzanelli » Sun May 03, 2009 6:23 pm

SatishKumar Thanks for the reply.

I'm unsure of where I can use your setLayoutParams.

Here's my issue, I've "designed" my View in XML,

Its a TableLayout - I have a textView at the top (a heading), followed by a list of some items in a ListView,

After this I have a TextView, followed by a TableRow (which has numerous ImageView inside it) -

My problem, is the ListView height needs to be increased, as the list has to be scrolled.

See my layout here


Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
        <TableLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/myTableLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView android:id="@+id/header1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Header1"
        android:textSize = "20sp"
       
        />
     
         <ListView android:id="@+id/aList"
        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
             android:minHeight = "150sp"
        android:paddingTop="10dip"
       
        />
     
     <TextView android:id="@+id/heading2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Text Heading 2 here."
        android:textSize = "20sp"

        />
     <TableRow
     android:padding="20dip"
     >

         <ImageView
        android:id="@+id/image1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="12dip"
        android:layout_gravity="center"
        android:src="@drawable/icon2" />
       
  <ImageView
        android:id="@+id/image1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="12dip"
        android:layout_gravity="center"
        android:src="@drawable/icon2" />

         <ImageView
        android:id="@+id/image1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="12dip"
        android:layout_gravity="center"
        android:src="@drawable/icon2" />
         
<ImageView
        android:id="@+id/image1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="12dip"
        android:layout_gravity="center"
        android:src="@drawable/icon2" />
       
       
 
     </TableRow>
<!-- More TableRows to follow -->
     
</TableLayout>
       
        </ScrollView>


Does this make sense? I want to have a TextView at the top, followed by a ListView, followed by some TableRow's of images..

I hope this is clearer.

Thanks in advance for your thoughts

Will
Will
williamzanelli
Experienced Developer
Experienced Developer
 
Posts: 63
Joined: Mon Jan 05, 2009 2:37 am
Location: UK

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests