Sunday, December 26, 2010

[android-developers] RelativeLayout problems

I'm attempting a not-that-complex layout using RelativeLayout, and getting a weird problem.

When I set things up in a way that seems correct, I get:

Thread [<3> main] (Suspended (exception IllegalStateException))   
    RelativeLayout$DependencyGraph.getSortedViews(View[], int...) line: 1260   
    RelativeLayout.sortChildren() line: 281   
    RelativeLayout.onMeasure(int, int) line: 299   
    RelativeLayout(View).measure(int, int) line: 7964   
    ....

The full layout is at the bottom of this msg.
If I delete just one line,
     android:layout_toRightOf="@id/Spin"
from the 3rd widget (ImageButton), the layout then sort-of works. (well, at least it doesn't crash)

The 1st NumberPicker (SpinMeasure) is at the top of the screen - but is the full screen width.
The BtnRun is at the top right corner, overlapping SpinMeasure.  BtnMute and CenterLayout appear correct.
SpinRate isn't visible.  It's either not there, or is under SpinMeasure.

Any suggestions on what I'm doing wrong?

----- landscape layout -----

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/WholeScreen"
>
    <com.casadelgato.widgets.NumberPicker
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        plusminus_width="50"
        vertical="false"
        minValue="0"
        defaultValue="4"
        maxValue="16"
        android:id="@+id/SpinMeasure" />
    <com.casadelgato.widgets.NumberPicker
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@id/SpinMeasure"
        android:layout_toLeftOf="@+id/BtnRun"
        minValue="20"
        defaultValue="60"
        maxValue="240"
        repeatAcceleration = "10"
        vertical="false"
        android:id="@id/SpinRate"/>
    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@id/SpinRate"
        android:src="@drawable/ic_menu_play_clip"
        android:id="@id/BtnRun" />
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_toLeftOf="@+id/BtnMute"
        android:layout_below="@id/SpinRate"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:id="@+id/CenterLayout" />
    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignLeft="@id/BtnRun"
        android:src="@drawable/ic_jog_dial_sound_off"
        android:id="@id/BtnMute" />
</RelativeLayout>

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment