Eno
Eno

Reputation: 10850

Disappearing imagebutton in my layout - why?

The last image button is not being rendered (in fact I see an error which quickly disappears to show the rest of my view minus the last imagebutton.

My activity layout looks like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent">
     <ScrollView android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF">
      <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:stretchColumns="1, 2">
       <TableRow>
           <ImageButton android:background="#ffffff" android:src="@drawable/gettingstarted_cover" android:paddingTop="10px" android:paddingLeft="8px" android:paddingBottom="10px" android:layout_gravity="center_vertical|left"/>
           <TextView android:text="@string/book_title1" android:textColor="#000000" android:paddingTop="10px" android:paddingLeft="8px" android:layout_gravity="center_vertical|center_horizontal"/>
           <ImageButton android:src="@drawable/icon_i_page" android:background="#ffffff" android:layout_gravity="center_vertical|right" android:paddingRight="8px"/>
          </TableRow>
          <View android:layout_height="1px" android:background="#CCCCCC" />
          <TableRow>
           <ImageButton android:background="#ffffff" android:src="@drawable/underthedome_cover" android:paddingTop="10px" android:paddingLeft="8px" android:paddingBottom="10px" android:layout_gravity="center_vertical|left" />
           <TextView android:text="@string/book_title2" android:textColor="#000000" android:paddingTop="10px" android:paddingLeft="8px" android:layout_gravity="center_vertical|center_horizontal" />
           <ImageButton android:src="@drawable/icon_i_page" android:background="#ffffff" android:layout_gravity="center_vertical|right" android:paddingRight="8px"/>
          </TableRow>
          <View android:layout_height="1px" android:background="#CCCCCC" />
         </TableLayout>
     </ScrollView>
     <ImageButton android:src="@drawable/free" android:background="#ffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="10px"/>
    </LinearLayout>

Tried to debug this in Eclipse but didn't find the cause.

Upvotes: 0

Views: 1616

Answers (1)

Alex Volovoy
Alex Volovoy

Reputation: 68444

Change you LinearLayout to Relative , android:layout_alignParentTop="true" on your image view. if srcollvew will be covered by imageview , move it after (just in case you're in 1.5) image view, and set android:layout_below="@id/myimagevieid" id on the view has to be set as well by android:id="@+id/myimagevieid"

Upvotes: 1

Related Questions