I've a vertical LinearLayout containing following widgets displayed in center with LinearLayout's gravity set to "center":
- ImageView
- TextInputLayout
- TextInputLayout
- Button
This looks fine normally when when on smaller screen devices, the button in bottom is going out of view. This goes even worst when I display error for both TextInputLayouts.
Screenshots Normal Screens:
Screenshots Small Screens:
PROBLEM:
What I want is that on small screens, the ImageView should resize itself to accommodate all views, while on bigger screens, ImageView should keep its maximum available size while all contents appear in center (as in Screenshot 1).
Any help would be greatly appreciated! :)
SOURCE XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/input_view_margin"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_transaction_history_big" />
<TextView
style="@style/ReportHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_transaction_history" />
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="40dp" />
<TextInputLayout
android:id="@+id/wrapperFromDate"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextInputEditText
android:id="@+id/edtFromDate"
style="@style/InputLayoutEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="@string/hint_from_date" />
</TextInputLayout>
<TextInputLayout
android:id="@+id/wrapperToDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextInputEditText
android:id="@+id/edtToDate"
style="@style/InputLayoutEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="@string/hint_to_date" />
</TextInputLayout>
<Button
android:id="@+id/btnSubmit"
style="@style/PrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:text="@string/action_submit" />
</LinearLayout>