sulewicz / springlayout

RelativeLayout on steroids.
MIT License
79 stars 15 forks source link

Layout margin, incorrect height #7

Open westito opened 9 years ago

westito commented 9 years ago

I weighted two views ( 50% - 50% ) to each other. I would add a padding between with marginLeft and marginRight, but the margin is omitted! It is works in regular RelativeLayout. It can be workarounded (+view between the two), but it not the nicest solution.

Incorrect height: When I position vertically the whole springlayout in relative layout (below to a header), the height is not updated and will be below the screen bottom. If I set the alignParentBottom the frame will be correct, but a view inside the springlayout still use the incorrect size, and runs out of height (bottom not showing)

I enclosed three screenshots: two shows the issue, the third is just a sample, why it is problem (button aligned to the bottom). Intellij incorrectly show it is a RelativeLayout in tree, but it is SpringLayout (bug in intelliJ)

screenshot-2015-01-14-22 12 screenshot-2015-01-14-22 01 screenshot-2015-01-14-22 04

sulewicz commented 9 years ago

Hi!

Thank you for the bug report! Would it be possible for you to provide also the xml file of the layout? Thanks in advance!

Cheers, Sz

westito commented 9 years ago

Sure! I removed the inner content. It is irrelevant. Add height to the header, and you can see the issue. (I removed the code what i made for sample. Simply change the middle view to RelativeLayout with a button in it).

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

    <RelativeLayout
        android:id="@+id/title_panel_root"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="50dp"
        android:layout_marginRight="60dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        [Header]
    </RelativeLayout>

    <org.coderoller.springlayout.SpringLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:layout_marginBottom="30dp"
        android:layout_below="@+id/title_panel_root"
        android:layout_alignParentBottom="true">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="15dp"
            android:paddingRight="20dp"
            android:paddingLeft="20dp"
            android:paddingBottom="15dp"
            app:layout_widthWeight="1"
            android:id="@+id/layout_profile"
            android:background="@drawable/settings_bg_frame">

            [Left content]
        </LinearLayout>

        <View
            android:layout_width="20dp"
            android:layout_height="0dp"
            app:layout_toRightOf="@+id/layout_profile"
            android:id="@+id/spring_padding"/>

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/layout_children"
            app:layout_widthWeight="1"
            app:layout_alignParentRight="true"
            app:layout_toRightOf="@+id/spring_padding"
            app:layout_alignBottom="@+id/layout_profile"
            app:layout_alignParentTop="true"
            android:background="@drawable/settings_bg_frame">

            [Right content]
        </LinearLayout>
    </org.coderoller.springlayout.SpringLayout>
</RelativeLayout>