I'm not too sure why this is happening... i'm guess that alignBaseline 
affects measuring differently and causes a cyclic dependency (Romain?)

Try changing the relationships so you'll define A and B Below C instead, 
since C has a constant location anyhow.

Also if your View hierarchy isnt too complex and wouldn't need to be 
refreshed too often, you can let yourself use more ViewGroups (use a 
linearlayout to divide the top and the bottom views)... Although that 
increases the amount of views you have and makes the rendering tree bigger, 
it will be easier for you to read the XML and understand the behavior and 
also prevent this weird behavior. 

On Tuesday, May 21, 2013 5:49:20 PM UTC+3, Dusk Jockeys Android Apps wrote:
>
> I have a layout issue which it seems should be simple to do in a 
> RelativeLayout.
>  
> I have a view A, and a view B which is aligned to A's baseline, and 
> aligned to the right of the parent. B appears correctly.
>  
> Then I want a view C to be directly above B, and also aligned to the right 
> of the parent. However, C never appears. 
>  
> However, if I change B to be aligned to the *bottom* of A, as opposed to 
> its *baseline*, then C appears. 
>  
> So it seems that layout_above doesn't like to act upon something that 
> references another view via layout_alignBaseline, but is fine acting upon 
> something that references another View via layout_alignBottom.
>  
> Can anyone shed any light upon this? It seems like it is a common scenario 
> that should work. See the following.
>  
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
>     android:id="@+id/mainlayout"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     android:orientation="vertical" >
>     <TextView
>         android:id="@+id/A"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:text="A"
>         android:textColor="@android:color/white"
>         android:textSize="182dp" />
>     <TextView
>         android:id="@+id/B"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:layout_alignBaseline="@id/A"
>         android:layout_alignParentRight="true"
>         android:text="B"
>         android:textColor="@android:color/white"
>         android:textSize="26dp" />
>     <TextView
>         android:id="@+id/C"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>          android:layout_alignParentRight="true"
>         android:layout_above="@id/B"
>         android:text="C never appears!"
>         android:textColor="@android:color/white"
>         android:textSize="20dp" />
> </RelativeLayout>
>  
> Regards,
> James
>

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to