samedi 9 mai 2015

RealtiveLayout Parent PaddingTop not working on Phone

I've used PaddingTop on RelativeLayout and it does not work on my phone but it works on the xml preview with Nexus 5. Here's the code I use . I have tried padding bottom just to be sure but still it doesn't work and the last button just stick to the end of the device screen but it does not in the xml preview.

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/primary_color"
    android:paddingTop="@dimen/action_bar_height">

    <ImageView
        android:id="@+id/image_cloud"
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginRight="-180dp"
        android:src="@drawable/ic_onboarding_cloud" />

    <ImageView
        android:id="@+id/image_cloud_3"
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_below="@id/image_cloud"
        android:layout_marginRight="-250dp"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_onboarding_cloud_2" />

    <ImageView
        android:id="@+id/image_cloud_2"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/image_cloud_3"
        android:layout_marginRight="-240dp"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_onboarding_cloud_2" />

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="150dp"
        android:layout_marginTop="50dp"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_tagline"/>

    <ImageView
        android:id="@+id/image_buildings"
        android:layout_width="wrap_content"
        android:layout_height="150dp"
        android:layout_above="@+id/btn_signup"
        android:scaleType="centerCrop"
        android:src="@drawable/ic_onboarding_building" />

    <Button
        android:id="@+id/btn_signup"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/secondary_color"
        android:padding="@dimen/activity_vertical_margin"
        android:text="@string/btn_signup"
        android:textAllCaps="true"
        android:textColor="@color/white"
        android:textStyle="bold"
        android:layout_above="@+id/btn_exisiting"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

    <Button
        android:id="@+id/btn_exisiting"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/tertiary_color"
        android:padding="@dimen/activity_vertical_margin"
        android:text="@string/btn_existinguser"
        android:textAllCaps="true"
        android:textColor="@color/white"
        android:textStyle="bold" />
</RelativeLayout>

Aucun commentaire:

Enregistrer un commentaire