0

I guess there are hundreds of small (and big) bugs regarding Android GUI..but this one really grinds my gears !

When I have a RelativeLayout, and I put some button on the bottom of the layout and set it's margins to 30dp, for example. I cannot see that change in eclipse, but when I start the app on my phone, I can see that it IS having a 30dp margin. It is like this for all the devices i put (nexus4, nexus10,...)

EDIT: You can see a a tiny little margin on the picture, but that will stay the same, no matter if i put margin to 30 or 300dp!

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="30dp"
    android:layout_toRightOf="@+id/dndequation2"
    android:text="Button" />

Bottom Margins Screenshot

Next, Also in relative Layout, I have the next bug: I put one button at center of the layout

    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"

And then, when I want to put a button BELOW that one, it appears ABOVE it !

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/drag_and_drop_zone"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:text="Button" />

enter image description here

EDIT2: This is screenshot for Nexus4 device. When I change that to Nexus10, It appears as it should: enter image description here

Can any1 tell me if there are some settings I could change to avoid this torture and brain damage, google had put upon us?

Thanks in advance

EDIT3: this is my full XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rising_sun_blue" >

<TextView
    android:id="@+id/dnd_equation1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/drag_and_drop_zone"
    android:paddingLeft="15dp"
    android:textColor="#000000"
    android:textSize="30sp"
    android:text="3+1" />

<TextView
    android:id="@+id/dndequation2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:layout_toLeftOf="@+id/drag_and_drop_zone"
    android:gravity="right"
    android:paddingRight="15dp"
    android:textColor="#000000"
    android:textSize="30sp"
    android:text="5-4" />

<Button
    android:id="@+id/drag_and_drop_zone"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:background="@drawable/white_button" />

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/drag_and_drop_zone"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:text="Button" />

</RelativeLayout>
SteBra
  • 4,188
  • 6
  • 37
  • 68

0 Answers0