1. Download our Official Android App: Forums for Android!

Apps dialog layout breaks in ICS

Discussion in 'Android Development' started by airswit, Dec 29, 2011.

  1. airswit

    airswit Lurker
    Thread Starter
    Rank:
    None
    Points:
    6
    Posts:
    5
    Joined:
    Dec 19, 2009

    Dec 19, 2009
    5
    1
    6
    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 (Text):
    1.  
    2.       <activity android:name="EditRecord"
    3.          android:label="Edit Record"
    4.          android:theme="@android:style/Theme.Dialog"
    5.       >
    6. .....
    7.       </activity>
    8.  

    main layout file (landscape):
    Code (Text):
    1.  
    2. <LinearLayout
    3.    xmlns:android="http://schemas.android.com/apk/res/android"
    4.    android:orientation="horizontal"
    5.    android:layout_width="fill_parent"
    6.    android:layout_height="fill_parent"
    7.    android:gravity="center_horizontal"
    8.    android:id="@+id/root">
    9.    <ScrollView
    10.       android:layout_width="wrap_content"
    11.       android:layout_height="wrap_content"
    12.       android:paddingRight="5dp">
    13.       <include
    14.          layout="@layout/edit_record_top" />
    15.    </ScrollView>
    16.    <ScrollView
    17.       android:layout_width="wrap_content"
    18.       android:layout_height="wrap_content"
    19.       android:paddingRight="5dp">
    20.       <include
    21.          layout="@layout/edit_record_bottom" />
    22.    </ScrollView>
    23. </LinearLayout>
    24.  
    Left column of layout (truncated to just show one row):
    Code (Text):
    1.  
    2. <merge
    3.    xmlns:android="http://schemas.android.com/apk/res/android">
    4.    <RelativeLayout
    5.       android:layout_width="wrap_content"
    6.       android:layout_height="wrap_content">
    7.       <TextView
    8.          android:layout_width="125dp"
    9.          android:layout_height="wrap_content"
    10.          android:text="@string/odo_label"
    11.          android:layout_alignBaseline="@+id/odo_reading"
    12.          android:id="@+id/odo_label" />
    13.       <EditText
    14.          android:layout_width="125dp"
    15.          android:layout_height="wrap_content"
    16.          android:maxLines="1"
    17.          android:inputType="numberDecimal"
    18.          android:layout_toRightOf="@id/odo_label"
    19.          android:id="@+id/odo_reading" />
    20. ....
    21.    </RelativeLayout>
    22. </merge>
    23.  
    Right column of layout:
    Code (Text):
    1.  
    2. <merge
    3.    xmlns:android="http://schemas.android.com/apk/res/android">
    4.    <RelativeLayout
    5.    android:layout_width="wrap_content"
    6.    android:layout_height="wrap_content">
    7.       <TextView
    8.          android:layout_width="125dp"
    9.          android:layout_height="wrap_content"
    10.          android:id="@+id/date_label"
    11.          android:layout_alignBaseline="@+id/date_reading"
    12.          android:text="@string/date_label" />
    13.       <!--
    14.          this is the place where the date is entered. Once the text
    15.          field is clicked on, a datePicker dialog box will show up,
    16.          where the user can change the date. the default date will be
    17.          the current date (encoded, if necessary)
    18.       -->
    19.       <EditText
    20.          android:layout_width="125dp"
    21.          android:layout_height="wrap_content"
    22.          android:inputType="none|date"
    23.          android:layout_toRightOf="@id/date_label"
    24.          android:id="@+id/date_reading" />
    25. ....
    26.       <Button
    27.          android:id="@+id/submit"
    28.          android:text="Submit Modifications"
    29.          android:layout_width="wrap_content"
    30.          android:layout_height="wrap_content"
    31.          android:layout_below="@id/mpg_diff_reading"
    32.          android:layout_centerHorizontal="true" />
    33.    </RelativeLayout>
    34. </merge>
    35.  
     

    Attached Files:


    Advertisement

  2. airswit

    airswit Lurker
    Thread Starter
    Rank:
    None
    Points:
    6
    Posts:
    5
    Joined:
    Dec 19, 2009

    Dec 19, 2009
    5
    1
    6
    alostpacket likes this.
  3. alostpacket

    alostpacket Over Macho Grande?
    Rank:
    None
    Points:
    513
    Posts:
    7,972
    Joined:
    Nov 29, 2009

    Nov 29, 2009
    7,972
    3,603
    513
    Android App Developer
    NY
    Thanks for posting your work-around :)
     

Share This Page

Loading...