• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps dialog layout breaks in ICS

airswit

Lurker
Dec 19, 2009
5
1
Hi all,

I wrote a program a while back, and it works fine on gingerbread/froyo, but running on ICS, it breaks. the layout editor in eclipse displays it the way i expect, when using the android 4.0[.3]/theme.DeviceDefault.Dialog. However, when I load my program on to the galaxy nexus (or emulator), the dialog displays one column correctly, then squishes the other.

any help appreciated!!

quick description: i have two columns of form data (each column contains a text label & text input, each 125dp wide). so the whole layout should be ~500dp wide (each of the two columns is 250dp wide). see the attached screenshots for the expected layout on gingerbread vs the broken layout on ics.

manifest file (relative portion):
Code:
      <activity android:name="EditRecord"
         android:label="Edit Record"
         android:theme="@android:style/Theme.Dialog"
      >
.....
      </activity>


main layout file (landscape):
Code:
<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="horizontal"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:gravity="center_horizontal"
   android:id="@+id/root">
   <ScrollView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingRight="5dp">
      <include
         layout="@layout/edit_record_top" />
   </ScrollView>
   <ScrollView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingRight="5dp">
      <include
         layout="@layout/edit_record_bottom" />
   </ScrollView>
</LinearLayout>

Left column of layout (truncated to just show one row):
Code:
<merge
   xmlns:android="http://schemas.android.com/apk/res/android">
   <RelativeLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
      <TextView
         android:layout_width="125dp"
         android:layout_height="wrap_content"
         android:text="@string/odo_label"
         android:layout_alignBaseline="@+id/odo_reading"
         android:id="@+id/odo_label" />
      <EditText
         android:layout_width="125dp"
         android:layout_height="wrap_content"
         android:maxLines="1"
         android:inputType="numberDecimal"
         android:layout_toRightOf="@id/odo_label"
         android:id="@+id/odo_reading" />
....
   </RelativeLayout>
</merge>

Right column of layout:
Code:
<merge
   xmlns:android="http://schemas.android.com/apk/res/android">
   <RelativeLayout
   android:layout_width="wrap_content"
   android:layout_height="wrap_content">
      <TextView
         android:layout_width="125dp"
         android:layout_height="wrap_content"
         android:id="@+id/date_label"
         android:layout_alignBaseline="@+id/date_reading"
         android:text="@string/date_label" />
      <!--
         this is the place where the date is entered. Once the text
         field is clicked on, a datePicker dialog box will show up,
         where the user can change the date. the default date will be
         the current date (encoded, if necessary)
      -->
      <EditText
         android:layout_width="125dp"
         android:layout_height="wrap_content"
         android:inputType="none|date"
         android:layout_toRightOf="@id/date_label"
         android:id="@+id/date_reading" />
....
      <Button
         android:id="@+id/submit"
         android:text="Submit Modifications"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@id/mpg_diff_reading"
         android:layout_centerHorizontal="true" />
   </RelativeLayout>
</merge>
 

Attachments

  • broken_ics.png
    broken_ics.png
    51 KB · Views: 69
  • working_gingerbread.png
    working_gingerbread.png
    55 KB · Views: 101
  • Like
Reactions: alostpacket
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones