medyo/Dynamicbox

DynamicBox make my layout chaotic

matdennoigi opened this issue · 1 comments

I use DynamicBox to show loading indicator when I requesting to server as below:

Activity Layout:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#2196F3"
    android:fitsSystemWindows="true"
    tools:context=".LoginActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|center_vertical"
        android:orientation="vertical"
        android:paddingTop="56dp"
        android:paddingLeft="24dp"
        android:paddingRight="24dp">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="90dp"
            android:layout_gravity="center_horizontal"
            android:adjustViewBounds="true"
            android:layout_marginBottom="24dp"
            android:src="@drawable/main_logo" />

        <android.support.design.widget.TextInputLayout
            android:id="@+id/til_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:theme="@style/AppTheme.AccountInputLayoutTheme"
            app:errorEnabled="true">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/txt_username"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textEmailAddress"
                android:hint="@string/input_email_hint" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/til_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:theme="@style/AppTheme.AccountInputLayoutTheme">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/txt_password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="@string/input_password_hint" />
        </android.support.design.widget.TextInputLayout>

        <android.support.v7.widget.AppCompatButton
            android:id="@+id/btn_login"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp"
            android:layout_marginBottom="24dp"
            android:padding="12dp"
            android:text="@string/login"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/create_account_link"
            android:gravity="center"
            android:textSize="16sp"
            android:autoLink="web"
            android:linksClickable="true"/>
    </LinearLayout>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Copyright by VNP 2016"
        android:layout_gravity="bottom"
        android:gravity="center"
        android:layout_marginBottom="5dp"/>

</FrameLayout>

Correct Layout on device:
screenshot_2015-12-24-09-29-58

But, when I add DynamicBox to activity:

Java Code:

...
public void onCreate(Bundle saveInstanceState) {
  this.box = new DynamicBox(this, R.layout.activity_myactivity);
}

Layout became:

screenshot_2015-12-24-09-36-10

medyo commented

Hi @matdennoigi,

Try to wrap your layout content with a linearlayout.