Centering images

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

Centering images

Postby williamzanelli » Wed Apr 29, 2009 2:09 pm

Hi guys,

I have a small issue,

I want to know how to centre images (imageView), which is inside TableRow

I'm using android:scaleType="center" - this doesnt seem to work. Is there anything else I could use?

I've attahced my XML.

Thanks for your thoughts in advance.

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
    android:layout_height="wrap_content">

        <TableLayout
    android:id="@+id/myTableLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView android:id="@+id/header"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:height = "34.5sp"
        android:text="Announcements"
        android:background = "#191970"
        android:paddingTop="10dip"
        android:paddingBottom="10dip"
        />
     
        <ListView android:id="@android:id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         android:paddingTop="5dip"
        android:paddingBottom="5dip"
        />
  <TextView android:id="@android:id/empty"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_data"
          android:paddingTop="5dip"
        android:paddingBottom="30dip"/>
     
     
     
     <TextView android:id="@+id/headerLogos"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Other Qs"
        android:height = "34.5sp"
        android:background = "#191970"
        android:paddingTop="10dip"
        android:paddingBottom="10dip"
        />
     <TableRow
     android:padding="30dip"
     >

         <ImageView
        android:id="@+id/imag1"
       
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="6dip"
        android:scaleType="center"
       
        android:src="@drawable/icon2" />
       
        <ImageView
        android:id="@+id/image2"
       
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="6dip"
        android:scaleType="center"
       
        android:src="@drawable/icon2" />
       
      <ImageView
        android:id="@+id/iumage3"
       
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="6dip"
        android:scaleType="center"
       
        android:src="@drawable/icon2" />
         
     </TableRow>
     
     
</TableLayout>
       
       

</LinearLayout>

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 7 guests