Align TextView widths in different LinearLayouts - java

I have this interface:
Using the below fragment XML. Is it possible to align the widths of the TextViews so they are all the same width?
For example, ODOMETER appears to be the longest word in a textview. How can I adjust all the other TextView's widths to match ODOMETERS? That way they all line up and the interface would be neater.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.mycompany.myapp.Views.MasterDetails.VehicleFragment">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="false"
android:scrollbars="none">
<LinearLayout
android:id="#+id/scrollViewVehicle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- YEAR -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="YEAR"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<EditText
android:id="#+id/editYear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLength="4"
android:maxLines="1"/>
</LinearLayout>
<!-- MAKE -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="MAKE"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<AutoCompleteTextView
android:id="#+id/editMake"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- MODEL -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="MODEL"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<AutoCompleteTextView
android:id="#+id/editModel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- BODY -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="BODY"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<AutoCompleteTextView
android:id="#+id/editBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- COLOR -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="COLOR"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<AutoCompleteTextView
android:id="#+id/editColor"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- TAG -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="TAG"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<EditText
android:id="#+id/editTag"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- STATE -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="STATE"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<AutoCompleteTextView
android:id="#+id/editState"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- Odometer -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="ODOMETER"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<EditText
android:id="#+id/editOdometer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
<!-- VIN -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="VIN"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<EditText
android:id="#+id/editVIN"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="17"
android:maxLines="1"/>
<Button
android:id="#+id/btnScanVIN"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/COLOR_TXI_BLUE"
android:text="SCAN"
android:textColor="#color/COLOR_TXI_WHITE"
android:textStyle="bold"/>
</LinearLayout>
<!-- Other -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="OTHER"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<EditText
android:id="#+id/editOther"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

Of course it is possible. You're using a horizontal layout for every couple of label-text field. Do as follow:
add android:weightSum="z" to every LinearLayout
add android:layout_weight="0.y" to every Label
add android:layout_weight="0.x" to every Text Field
Note that 0.x + 0.y must equals to z. Obviously you need to set number values.
EDIT:
This code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.mycompany.myapp.Views.MasterDetails.VehicleFragment">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="false"
android:scrollbars="none">
<LinearLayout
android:id="#+id/scrollViewVehicle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- YEAR -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="YEAR"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<EditText
android:id="#+id/editYear"
android:layout_width="match_parent"
android:layout_weight="0.8"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLength="4"
android:maxLines="1"/>
</LinearLayout>
<!-- MAKE -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:paddingTop="10dp"
android:text="MAKE"
android:textColor="#color/COLOR_TXI_BLUE"
android:textStyle="bold"/>
<AutoCompleteTextView
android:id="#+id/editMake"
android:layout_width="match_parent"
android:layout_weight="0.8"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLength="30"
android:maxLines="1"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Works great and I get this result

Related

Pin ImageView and headed view in the top while scrolling and make the other view as scrollable in android

I need to pin the image while scrolling with the headed section and need to scroll other thing in the screen.
Here I need the header as fixed while scrolling and the half of the fill 2 image shown while scrolling.
Now the header actionsof on click are not working after addding nestedScrollView.
Also the nested view is overlapping with the above view while scrolling
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="#+id/coordinator"
style="#style/CoordinatorLayout"
android:background="red"
tools:ignore="RtlHardcoded">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/layout_app_bar"
style="#style/Collapsing.AppBarLayout"
android:background="blue">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="#+id/layout_collapsing_toolbar"
style="#style/Collapsing.CollapsingToolbarLayout"
android:layout_height="427dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/spacing_x5"
android:background="green"
android:gravity="center"
android:id="#+id/header_view"
android:visibility="visible"
android:orientation="horizontal">
<ImageView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#drawable/black"
android:clickable="true"
android:contentDescription="#string/back"
android:src="#drawable/ic_arrow_left"/>
<TextView
android:id="#+id/header_my_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:textSize="18dp"
android:gravity="center"
android:textColor="#color/white"
android:scaleType="centerInside"
android:text="MY Home Feed"/>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:orientation="vertical"
>
<TextView
android:id="#+id/label1"
android:layout_width="80dp"
android:layout_height="48dp"
android:gravity="center"
android:visibility="visible"
android:clickable="true"
android:textSize="18dp"
android:textColor="#707070"
android:text="label1"
/>
</RelativeLayout>
</LinearLayout>
<ImageView
android:id="#id/iv_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="50dp"
android:adjustViewBounds="true"
android:src="#drawable/image" />
<ImageView
android:id="#id/fill_1"
android:src="#drawable/fill_1"
android:scaleType="fitStart"
android:layout_marginTop="148dp"
android:layout_marginLeft="-20dp"
android:layout_marginRight="-20dp"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ImageView
android:id="#id/fill_2"
android:src="#drawable/fill_2"
android:scaleType="fitCenter"
android:layout_marginTop="128dp"
android:layout_marginLeft="-20dp"
android:layout_marginRight="-20dp"
android:layout_marginBottom="-30dp"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</FrameLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
style="#style/Collapsing.Toolbar" />
<View
android:id="#+id/divider"
style="#style/Collapsing.Divider" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="#+id/nested_scroll">
<LinearLayout
android:layout_width="match_parent"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_marginTop="500dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:textSize="27dp"
android:layout_marginTop="5dp"
android:layout_gravity="center"
>
</TextView>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/recycler_view"
android:orientation="horizontal"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
<View style="#style/Divider.Horizontal.Gray"
android:layout_width="match_parent"
android:layout_marginTop="#dimen/spacing_x2"
android:layout_marginBottom="#dimen/spacing_x2"
android:layout_height="2dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_marginLeft="20dp"
android:visibility="gone"
android:layout_marginRight="20dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:textSize="21sp"
android:layout_weight="1"
android:layout_gravity="left"
>
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:textSize="14sp"
android:layout_weight="0.1"
android:layout_gravity="right"
android:text="lanl">
</TextView>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/recycler_view"
android:visibility="gone"
android:orientation="vertical"
>
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:layout_width="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:textSize="21sp"
android:layout_weight="1"
>
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:textSize="14sp"
android:layout_weight="0.1"
android:layout_gravity="right"
>
</TextView>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
android:id="#+id/recycler_view1"
android:orientation="horizontal"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
<View style="#style/Divider.Horizontal.Gray"
android:layout_width="match_parent"
android:layout_marginTop="#dimen/spacing_x2"
android:layout_marginBottom="#dimen/spacing_x2"
android:layout_height="2dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:layout_weight="1"
android:layout_gravity="left"
>
</TextView>
<ImageView
android:layout_width="30dp"
android:layout_height="27dp"
android:layout_weight="0.1"
android:layout_gravity="right"
>
</ImageView>
</LinearLayout>
<com.google.android.material.tabs.TabLayout
android:id="#+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#id/search"
android:layout_marginTop="15dp"
android:background="#color/dark_blue"
app:tabGravity="fill"
app:tabIndicatorColor="#color/blue_light"
app:tabIndicatorHeight="5dp"
app:tabMode="scrollable" />
<com.finaonation.utility.NonScrollableViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_margin="20dp"
android:orientation="horizontal"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:layout_width="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:layout_weight="1"
android:layout_gravity="left"
android:textSize="16sp"
</TextView>
<ImageView
android:layout_width="30dp"
android:layout_height="27dp"
android:layout_weight="0.1"
android:layout_gravity="right"
>
</ImageView>
</LinearLayout>
<View style="#style/Divider.Horizontal.Gray"
android:layout_width="match_parent"
android:layout_marginTop="#dimen/spacing_x2"
android:layout_marginBottom="#dimen/spacing_x2"
android:layout_height="2dp"
android:id="#+id/divider"
android:visibility="visible"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_margin="20dp"
android:id="#+id/recycler_view_m"
android:orientation="horizontal"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<android.support.design.widget.CoordinatorLayout
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.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<!-- HEADER -->
<RelativeLayout
...
app:layout_collapseMode="parallax">
.....
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
<!-- IF YOU WANT TO KEEP "Choose Item" always on top of the RecyclerView, put this TextView here
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="choose item" />
-->
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>

Automatic scrolling when the keyboard is opened

I want the screen to automatically scroll up when the keyboard opens, so that the user can see what he has written.
The solution I found was to change the manifest and use adjustPan or adjustResize. I used both of them but it still didn't work.
Where is my mistake?
Thanks in advance.
xml:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
tools:context=".auth.LoginActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:src="#mipmap/img_login"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
tools:ignore="MissingConstraints" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-100dp"
android:orientation="vertical"
android:background="#drawable/login_back">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:textColor="#color/customColor"
android:gravity="center"
android:textSize="30dp"
android:layout_marginTop="42dp"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:focusableInTouchMode="true"
android:hint="User Name"
android:layoutDirection="rtl"
android:textColorHint="#color/customColor"
>
<EditText
android:id="#+id/acLogin_edtUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="ltr"
android:inputType="textEmailAddress"
android:textSize="16dp"
android:singleLine="true"
android:textColor="#color/customColor"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:focusableInTouchMode="true"
android:hint="Password"
android:layoutDirection="rtl"
android:textColorHint="#color/customColor"
>
<EditText
android:id="#+id/acLogin_edtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textSize="16dp"
android:textColor="#color/customColor"
/>
</com.google.android.material.textfield.TextInputLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="42dp"
android:layout_gravity="center"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="#color/customColor"
app:cardCornerRadius="8dp">
<TextView
android:id="#+id/acLogin_txtLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Login"
android:textColor="#ffffff"
android:textSize="18dp" />
<ProgressBar
android:id="#+id/acLogin_prgLoading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:visibility="gone" />
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="48dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Don't have any account?"
android:gravity="bottom"
android:layout_marginLeft="58dp"
android:textColor="#color/customColor"
android:textSize="16dp"/>
<TextView
android:id="#+id/acLogin_txtSignUp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:gravity="bottom"
android:text="Sign Up"
android:textColor="#color/customColor"
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="200dp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I change manifest to:
<activity android:name=".auth.LoginActivity"
android:windowSoftInputMode="adjustPan | adjustResize"/>

How to add Layout on top of another Layout?

My English is poor. So I threw off the video. I think any programmer looking at this will understand the reason. Thank you in advance
I want to learn how to use ReleaseativeLayout correctly, because ConstainLayout is very buggy. Even using it in Android Studio Canary.
So I'm using ReleativeLayout and LineartLayout now. These are the most effective ViewGroup. I thought. But it turned out all wrong
XML Code
<RelativeLayout
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:gravity="center"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
android:background="#drawable/login_faggot">
<TextView
android:gravity="center_horizontal"
android:layout_above="#+id/plsLogin"
android:text="Welcome."
android:textSize="18sp"
android:textColor="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginBottom="25dp"
android:textSize="16sp"
android:textColor="#color/grayBg"
android:gravity="center_horizontal"
android:id="#+id/plsLogin"
android:layout_above="#+id/editLogin"
android:text="Please Login."
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:background="#color/white"
android:layout_alignLeft="#+id/editLogin"
android:layout_alignBaseline="#+id/editLogin"
android:layout_marginStart="50dp"
android:layout_width="1dp"
android:layout_height="wrap_content"/>
<TextView
android:background="#color/white"
android:layout_alignLeft="#+id/editPass"
android:layout_alignBaseline="#+id/editPass"
android:layout_marginStart="50dp"
android:layout_width="1dp"
android:layout_height="wrap_content"/>
<EditText
android:paddingStart="20dp"
android:drawableStart="#drawable/ic_mail_white_24dp"
android:drawablePadding="15dp"
android:hint="#string/user_name"
android:layout_alignStart="#+id/buttonLogin"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_above="#+id/editPass"
android:id="#+id/editLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:drawableStart="#drawable/ic_lock_white_24dp"
android:paddingStart="20dp"
android:drawablePadding="15dp"
android:hint="#string/password"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_alignStart="#+id/buttonLogin"
android:layout_above="#+id/linearLayout"
android:id="#+id/editPass"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginStart="15dp"
android:id="#+id/linearLayout"
android:layout_above="#+id/buttonLogin"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_alignStart="#+id/buttonLogin"
android:layout_width="match_parent"
android:layout_marginBottom="50dp"
android:layout_height="wrap_content">
<CheckBox
style="#style/Widget.AppCompat.CompoundButton.RadioButton"
android:id="#+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remember Me"
android:paddingStart="15dp"
android:textColor="#color/white"/>
<TextView
android:visibility="invisible"
android:id="#+id/textView"
android:textColor="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Forgot Password"/>
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
android:layout_marginStart="30dp"
android:background="#drawable/button_round_corner"
app:backgroundTint="#color/colorOrangeUsSite"
android:text="#string/login"
android:textColor="#color/white"/>
<FrameLayout
android:background="#color/black"
android:alpha="0.8"
android:visibility="gone"
android:id="#+id/layoutProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:theme="#style/ProgressBar"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
</RelativeLayout>
Just add one more Relative Layout below of your parent layout and set Gravity to it
<RelativeLayout
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:theme="#style/ThemeOverlay.AppCompat.Dark"
android:background="#drawable/login_faggot">
<RelativeLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent">
<TextView
android:gravity="center_horizontal"
android:layout_above="#+id/plsLogin"
android:text="Welcome."
android:textSize="18sp"
android:textColor="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginBottom="25dp"
android:textSize="16sp"
android:textColor="#color/grayBg"
android:gravity="center_horizontal"
android:id="#+id/plsLogin"
android:layout_above="#+id/editLogin"
android:text="Please Login."
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:background="#color/white"
android:layout_alignLeft="#+id/editLogin"
android:layout_alignBaseline="#+id/editLogin"
android:layout_marginStart="50dp"
android:layout_width="1dp"
android:layout_height="wrap_content"/>
<TextView
android:background="#color/white"
android:layout_alignLeft="#+id/editPass"
android:layout_alignBaseline="#+id/editPass"
android:layout_marginStart="50dp"
android:layout_width="1dp"
android:layout_height="wrap_content"/>
<EditText
android:paddingStart="20dp"
android:drawableStart="#drawable/ic_mail_white_24dp"
android:drawablePadding="15dp"
android:hint="#string/user_name"
android:layout_alignStart="#+id/buttonLogin"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_above="#+id/editPass"
android:id="#+id/editLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:drawableStart="#drawable/ic_lock_white_24dp"
android:paddingStart="20dp"
android:drawablePadding="15dp"
android:hint="#string/password"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_alignStart="#+id/buttonLogin"
android:layout_above="#+id/linearLayout"
android:id="#+id/editPass"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginStart="15dp"
android:id="#+id/linearLayout"
android:layout_above="#+id/buttonLogin"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_alignStart="#+id/buttonLogin"
android:layout_width="match_parent"
android:layout_marginBottom="50dp"
android:layout_height="wrap_content">
<CheckBox
style="#style/Widget.AppCompat.CompoundButton.RadioButton"
android:id="#+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remember Me"
android:paddingStart="15dp"
android:textColor="#color/white"/>
<TextView
android:visibility="invisible"
android:id="#+id/textView"
android:textColor="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Forgot Password"/>
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
android:layout_marginStart="30dp"
android:background="#drawable/button_round_corner"
app:backgroundTint="#color/colorOrangeUsSite"
android:text="#string/login"
android:textColor="#color/white"/>
</RelativeLayout>
<FrameLayout
android:background="#color/black"
android:alpha="0.8"
android:visibility="gone"
android:id="#+id/layoutProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:theme="#style/ProgressBar"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
Only parent layout height and width would match parent instead of a child.
you've have entered FrameLayout height="match_parent"
you've to implement like this.
<RelativeLayout
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:gravity="center"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
android:background="#drawable/login_faggot">
<TextView
android:gravity="center_horizontal"
android:layout_above="#+id/plsLogin"
android:text="Welcome."
android:textSize="18sp"
android:textColor="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginBottom="25dp"
android:textSize="16sp"
android:textColor="#color/grayBg"
android:gravity="center_horizontal"
android:id="#+id/plsLogin"
android:layout_above="#+id/editLogin"
android:text="Please Login."
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:background="#color/white"
android:layout_alignLeft="#+id/editLogin"
android:layout_alignBaseline="#+id/editLogin"
android:layout_marginStart="50dp"
android:layout_width="1dp"
android:layout_height="wrap_content"/>
<TextView
android:background="#color/white"
android:layout_alignLeft="#+id/editPass"
android:layout_alignBaseline="#+id/editPass"
android:layout_marginStart="50dp"
android:layout_width="1dp"
android:layout_height="wrap_content"/>
<EditText
android:paddingStart="20dp"
android:drawableStart="#drawable/ic_mail_white_24dp"
android:drawablePadding="15dp"
android:hint="#string/user_name"
android:layout_alignStart="#+id/buttonLogin"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_above="#+id/editPass"
android:id="#+id/editLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:drawableStart="#drawable/ic_lock_white_24dp"
android:paddingStart="20dp"
android:drawablePadding="15dp"
android:hint="#string/password"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_alignStart="#+id/buttonLogin"
android:layout_above="#+id/linearLayout"
android:id="#+id/editPass"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginStart="15dp"
android:id="#+id/linearLayout"
android:layout_above="#+id/buttonLogin"
android:layout_alignEnd="#+id/buttonLogin"
android:layout_alignStart="#+id/buttonLogin"
android:layout_width="match_parent"
android:layout_marginBottom="50dp"
android:layout_height="wrap_content">
<CheckBox
style="#style/Widget.AppCompat.CompoundButton.RadioButton"
android:id="#+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remember Me"
android:paddingStart="15dp"
android:textColor="#color/white"/>
<TextView
android:visibility="invisible"
android:id="#+id/textView"
android:textColor="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Forgot Password"/>
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
android:layout_marginStart="30dp"
android:background="#drawable/button_round_corner"
app:backgroundTint="#color/colorOrangeUsSite"
android:text="#string/login"
android:textColor="#color/white"/>
<FrameLayout
android:background="#color/black"
android:alpha="0.8"
android:visibility="gone"
android:id="#+id/layoutProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:theme="#style/ProgressBar"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
</RelativeLayout>

Issues with matching width and height

I am trying to build this layout
But I am getting this: (The map button in the location would be ideal height and width but the textview doesn't match the height)
My location is a TextView and my destination is a EditText
I want the TextView and EditText to be the same width while the MAP buttons stay "square".
How can I get the textviews height to match and make a square map button?
Here is my layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mycompany.controller.DetailsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/viewStatus"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvLocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight=".8"
android:background="#color/COLOR_LIGHT_GREY"
android:text="123 MAIN ST., CHATTANOOGA TN 37404"
android:textSize="24sp"/>
<Button
android:id="#+id/btnMapLocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutDestination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editDestination"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".8"
android:ems="10"
android:inputType="textMultiLine"
android:text="407 Broad St., Anywhere ST 00000"/>
<Button
android:id="#+id/btnMapDestination"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I did a slight modification in your code check it!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/searchText"
android:text="Search text here"
android:layout_weight="0.8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#c8c8c8"
/>
<Button
android:id="#+id/searchButton"
android:text="MAP"
android:layout_weight="0.2"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/searchText"
android:text="Search text"
android:layout_weight="0.8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<Button
android:id="#+id/searchButton"
android:text="MAP"
android:layout_weight="0.2"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Since you are using android:layout_weight, set android:layout_width="0dp"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mycompany.controller.DetailsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/viewStatus"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvLocation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight=".8"
android:background="#color/COLOR_LIGHT_GREY"
android:text="123 MAIN ST., CHATTANOOGA TN 37404"
android:textSize="24sp"/>
<Button
android:id="#+id/btnMapLocation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutDestination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editDestination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:ems="10"
android:inputType="textMultiLine"
android:text="407 Broad St., Anywhere ST 00000"/>
<Button
android:id="#+id/btnMapDestination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

Views shrink when using keyboard with PercentageLayout

i have 2 different XML files. One is signup.xml the other chat.xml, both constructed with the PercentageLayout library.
the signup.xml works great - opening keyboard doesnt change any view.
However, in chat.xml whenever i pop the keyboard the view shrinks or out of screen, and i dont know why since i constructed them both nearly in the same manner, only i suspect that because i use ScrollView this happens.
The problematic layout, chat.xml :
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
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">
<!-- top -->
<LinearLayout
android:id="#+id/top"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="100%"
app:layout_heightPercent="8%"
android:background="#075607"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#acddf4"
android:textSize="20sp"
android:text="jfioewjfoiewjfoi"
android:gravity="center"
android:layout_gravity="center_horizontal|center_vertical" />
</LinearLayout>
<!-- Mid -->
<LinearLayout
android:id="#+id/mid"
android:layout_below="#+id/top"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="100%"
app:layout_heightPercent="84%"
android:background="#b1b7b3"
android:orientation="vertical">
<ScrollView
android:id="#+id/scroller"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#drawable/chat_bg" >
<LinearLayout
android:id="#+id/chatWindowContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
</LinearLayout>
<!-- Bottom -->
<LinearLayout
android:id="#+id/bottom"
android:layout_below="#+id/mid"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_widthPercent="100%"
app:layout_heightPercent="8%"
android:background="#000000"
android:orientation="horizontal">
<EditText
android:id="#+id/etMessage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:ems="10"
android:paddingLeft="5dp"
android:background="#drawable/text"
android:imeOptions="actionNone"
android:inputType="textMultiLine"
android:singleLine="false" />
<Button
android:id="#+id/bSendMessage"
android:layout_width="40dp"
android:layout_height="match_parent"
android:background="#drawable/ic_send"
android:layout_gravity="right" />
</LinearLayout>
And the working layout, signup.xml :
<LinearLayout
android:id="#+id/title"
android:layout_height="0dp"
android:layout_width="0dp"
app:layout_heightPercent="15%"
app:layout_widthPercent="100%">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/signup"/>
</LinearLayout>
<LinearLayout
android:id="#+id/mid"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_below="#+id/title"
app:layout_heightPercent="35%"
app:layout_widthPercent="100%"
android:baselineAligned="true">
<!-- Username -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
app:layout_heightPercent="20%"
app:layout_widthPercent="20%">
<ImageView
android:layout_width="35dp"
android:layout_height="wrap_content"
android:src="#drawable/person" />
<EditText
android:id="#+id/etUsername_signup"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ems="10"
android:inputType="text"
android:text="test"
android:textColor="#000000"
android:paddingLeft="5dp"
android:layout_weight="0.1"
android:background="#drawable/text">
<requestFocus />
</EditText>
</LinearLayout>
<!-- Email -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
app:layout_heightPercent="20%"
app:layout_widthPercent="20%">
<ImageView
android:layout_width="35dp"
android:layout_height="wrap_content"
android:src="#drawable/email" />
<EditText
android:id="#+id/etEmail_signup"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ems="10"
android:inputType="textEmailAddress"
android:text="email#address.com"
android:textColor="#000000"
android:paddingLeft="5dp"
android:layout_weight="0.1"
android:background="#drawable/text"/>
</LinearLayout>
<!-- Password1 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
app:layout_heightPercent="20%"
app:layout_widthPercent="20%">
<ImageView
android:layout_width="35dp"
android:layout_height="wrap_content"
android:src="#drawable/password" />
<EditText
android:id="#+id/etPassword1_signup"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ems="10"
android:inputType="textPassword"
android:text="pass"
android:textColor="#000000"
android:paddingLeft="5dp"
android:layout_weight="0.1"
android:background="#drawable/text"/>
</LinearLayout>
<!-- Password2 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
app:layout_heightPercent="20%"
app:layout_widthPercent="20%">
<ImageView
android:layout_width="35dp"
android:layout_height="wrap_content"
android:src="#drawable/password" />
<EditText
android:id="#+id/etPassword2_signup"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ems="10"
android:inputType="textPassword"
android:text="pass"
android:textColor="#000000"
android:paddingLeft="5dp"
android:layout_weight="0.1"
android:background="#drawable/text"/>
</LinearLayout>
<!-- Spinner and RadioGroup-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<Spinner
android:layout_width="100dp"
android:layout_height="match_parent"
android:id="#+id/spinner"
android:layout_gravity="center" />
<RadioGroup
android:id="#+id/rgRadius"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Kilometer" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mile" />
</RadioGroup>
</LinearLayout>
</LinearLayout>
<!-- Image -->
<LinearLayout
android:id="#+id/image"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_below="#+id/mid"
app:layout_heightPercent="40%"
app:layout_widthPercent="100%"
android:baselineAligned="true">
<ImageView
android:id="#+id/imgProfile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/faceless" />
</LinearLayout>
<!-- Button -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_heightPercent="10%"
app:layout_widthPercent="100%"
android:orientation="vertical"
android:layout_below="#id/image">
<Button
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/bSignup"
android:layout_gravity="center|bottom"
android:background="#drawable/button_send" />
</LinearLayout>
Use relative layout solve your shrinking layout problem I tested following layout.
Add following entry with activity tag : android:windowSoftInputMode="adjustResize"
And Your layout
<?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_width="match_parent"
android:layout_height="match_parent">
<!-- top -->
<LinearLayout
android:id="#+id/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#075607"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#acddf4"
android:textSize="20sp"
android:text="jfioewjfoiewjfoi"
android:gravity="center"
android:layout_gravity="center_horizontal|center_vertical" />
</LinearLayout>
<!-- Mid -->
<LinearLayout
android:id="#+id/mid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/bottom"
android:layout_below="#+id/top"
android:background="#b1b7b3"
android:orientation="vertical">
<ScrollView
android:id="#+id/scroller"
android:layout_width="match_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="#+id/chatWindowContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
</LinearLayout>
<!-- Bottom -->
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<EditText
android:id="#+id/etMessage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:ems="10"
android:paddingLeft="5dp"
android:imeOptions="actionNone"
android:inputType="textMultiLine"
android:singleLine="false" />
<Button
android:id="#+id/bSendMessage"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_gravity="right" />
</LinearLayout>
</RelativeLayout>

Categories