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">
           <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"/>
          <View android:layout_height="1px" android:background="#CCCCCC" />
           <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"/>
          <View android:layout_height="1px" android:background="#CCCCCC" />
     <ImageButton android:src="@drawable/free" android:background="#ffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="10px"/>

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

Asked by: First Name819 | Posted: 20-01-2022

Answer 1

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"

Answered by: Agata112 | Posted: 21-02-2022

Similar questions

java - Gen folder disappearing in Eclipse Android project

I'm just getting started developing for Android and I'm running into a weird problem. First off, I'm running Eclipse for Java devs v3.5.2 with the Android 2.1 SDK installed. Basically, whenever I do just about anything the "gen" (R.java, etc.) folder will just disappear from the project. I'm seen some people online say that it was still on the drive, just gone from the project listing in Eclipse, but in my case it...

eclipse - Android Device Disappearing

I have installed the Android SDK and plugin for Eclipse and written my first test app. I am trying to view the device in the DDMS section of Eclipse, but my Android Virtual Machine is usually not listed in the Devices section when it is running. Occasionally it will appear for a minute only to disappear again. I found an article recommending that I run adb kill-server to get it to restart and appear. This works about 5...

android - Disappearing dividers in Spinner drop-down list

I am writing my first simple Android App: It loads temperature samples from a Java based measurement system (CSV via HTTP), shows the available channels in a Spinner and when a channel is selected, it shows the corresponding value and a timestamp in two TextViews. The App works fine, except a little cosmetic problem: The items in the drop-down list are separated by a horizontal line (divider) and depending on the scroll po...

Disappearing AppWidgets for Android Development

I am developing an appwidget for android. It works fine when installing and running, but whenever the device is rebooted, the program can no longer use that widget. The activity is still selectable in the launcher, but there is no way to add the widget to the home screen without reinstalling the program. Have you hear of this happening? How can I fix this problem? Thanks so much!

android - R.Java is ALWAYS disappearing?

No matter what app i build it seems like the R.Java file always disappears no matter what! It is fine up in till i clean the project. From there it disappears. I have "Build Automatically" enabled as well Does any one know how to fix this. It is starting to get very annoying!

android - ListView Selected Rows Colors Disappearing

I have a custom ListView activity that maintains a state array (3 choices, default=black, one click=green, second click=red) for all items in the list. The color of the list item/row changes based on user selection, so I can use the color of the item for later data labelling. Now everything works fine until I scroll the selected items off the screen and return them to the active view, when their custom color disappears. Th...

android - listview items disappearing

So.. my listview items are disappearing after they're scrolled off the screen. They're there, you scoll down, back up, and they're gone. After rotation they reappear, but I have no idea why this is happening. package com.teslaprime.prirt; import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.content.Context; import android.content.ContentValues; import android...

Values disappearing from a Listview on Scroll - Android

I have a custom adapter extended from the SimpleCursorAdapter. Using this I'm binding a ListView which contains a checkbox and Two textboxes. On opening the activity, the list appears fine. But on clicking the checkboxes and entering some text in the textboxes and scrolling down, and then up again, the data disappears. In fact any change disappears, even if they were already checked. I uncheck them, then scroll dow...

android - shared preferences keep disappearing

I'm using the shared preferences to store login credentials for my app. Everything works fine except with one user. After a certain amount of time the shared preferences seem to be reset or cleared somehow. I've adjusted my app for this user to never clear his shared preferences anymore. This way I can be sure that it is not my app's fault. But even after this modification his credentials get cleared, so I'm suspecting som...

android - AdMob total requests disappearing and total revenue decreasing

Surely I'm not the only one, but I haven't been able to find any explanation on here or with a quick Google search; I apologize in advance if this question has been asked here before. I keep a daily log of my AdMob stats for my Android apps on the market, and I've seen a handful of days (sometimes consecutive) where both the Total Requests and the Total Revenue fields are going down. Obviously the eCPM, Fill Rate ...

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android