Android RelativeLayout displaying jumbled up - android

I have simple RelativeLayout with multiple elements. But the display is not as expected with some elements jumbled and on top of each other. It seems very strange to me and I am unable to figure out why it is so. Please see the screenshot attached.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp" >
<Button
android:id="#+id/btnClose"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:background="#21759b"
android:textColor="#FFFFFF"
android:text="Close" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add a missing Business"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:textColor="#21759b"
android:layout_below="#+id/btnClose"
android:layout_centerHorizontal="true"/>
<Spinner
android:id="#+id/spinnerContactType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:minWidth="250dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_below="#+id/title"
android:entries="#array/contactType" />
<android.support.design.widget.TextInputLayout
android:id="#+id/name_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#+id/spinnerContactType" >
<EditText
android:id="#+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/speciality_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#+id/name_layout" >
<EditText
android:id="#+id/speciality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business speciality" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/address_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#+id/speciality_layout" >
<EditText
android:id="#+id/address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Address" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/name_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#+id/address_layout" >
<EditText
android:id="#+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Phone" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/email_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#+id/phone_layout" >
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Email" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/timings_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#+id/email_layout" >
<EditText
android:id="#+id/timings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Timings" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="100dp"
android:layout_below="#+id/timings_layout"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:background="#21759b"
android:textColor="#FFFFFF"
android:layout_centerHorizontal="true"
android:text="Submit.." />
</RelativeLayout>
</ScrollView>

You can always use LinearLayout in these situations and its easier to manage but
if you don't want to change, this is your fixed layout :
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp" >
<Button
android:id="#+id/btnClose"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:background="#21759b"
android:textColor="#FFFFFF"
android:text="Close" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add a missing Business"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:textColor="#21759b"
android:layout_below="#id/btnClose"
android:layout_centerHorizontal="true"/>
<Spinner
android:id="#+id/spinnerContactType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:minWidth="250dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_below="#id/title"
android:entries="#array/contactType" />
<android.support.design.widget.TextInputLayout
android:id="#+id/name_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#id/spinnerContactType" >
<EditText
android:id="#+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/speciality_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#id/name_layout" >
<EditText
android:id="#+id/speciality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business speciality" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/address_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#id/speciality_layout" >
<EditText
android:id="#+id/address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Address" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/phone_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#id/address_layout" >
<EditText
android:id="#+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Phone" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/email_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#id/phone_layout" >
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Email" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/timings_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="4dp"
app:hintTextAppearance="#style/TextLabel"
android:layout_below="#id/email_layout" >
<EditText
android:id="#+id/timings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:maxLength="65"
android:hint="Business Timings" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="100dp"
android:layout_below="#+id/timings_layout"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:background="#21759b"
android:textColor="#FFFFFF"
android:layout_centerHorizontal="true"
android:text="Submit.." />
</RelativeLayout>
first problem with your code was in your case everywhere you used android:layout_below you should use #id/view_id because you had defined that view before and not #+id/view_id
the second problem was you added android:layout_below="#id/phone_layout" and you didn't define phone_layout you had only a view id of name_phone
hope this helps.

I quick review shows that the TextInputLayout with id email_layout uses a layout_below with an unused id of phone_layout.
Perhaps you meant it to reference name_phone. Doing so (or alternately changing the name_phone id) appears to remove the overlapping elements.
Also, I believe the use of #+id/... is only used for the first reference so subsequent references are typically #id/...

in your relative layout use
android:layout_height="wrap_content"
and set proper value for android:layout_marginTopOne more thing you are usin android:layout_below="#+id/phone_layout"but you haven't defined phone_layout

Make it easier for yourself and use LinearLayout instead on a vertical orientation.

I guess you want your email_layout to be below phone_layout, but look - you don't have the layout with id phone_layout - instead of it you have name_phone id. So all you need is to change name_phone id to phone_layout. Good luck :)

Related

Tried everything but relative layout click is not working at all

This is my layout where I want select_back relative layout to have click listener. But It's not working at all. I could not figure out the issue.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="#color/white">
<RelativeLayout
android:id="#+id/select_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginTop="20dp"
android:background="#color/white"
android:clickable="true"
android:focusable="true">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:drawableStart="#drawable/left_arrow"
android:drawablePadding="10dp"
android:focusable="false"
android:fontFamily="sans-serif"
android:text="#string/village_text"
android:textColor="#color/colorPrimaryDark"
android:textSize="15sp"
android:textStyle="normal">
</androidx.appcompat.widget.AppCompatTextView>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:fillViewport="false">
<LinearLayout
android:id="#+id/linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginRight="20dp"
android:orientation="vertical"
android:paddingBottom="20dp">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:src="#drawable/village_logo" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:fontFamily="sans-serif"
android:text="#string/village_title"
android:textColor="#color/title_colr"
android:textSize="20sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:backgroundTint="#color/edittext_tint"
android:focusable="true"
android:fontFamily="sans-serif"
android:gravity="start"
android:hint="#string/select_state"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/district"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/edittext_tint"
android:fontFamily="sans-serif"
android:gravity="start"
android:hint="#string/select_district"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/block"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/edittext_tint"
android:fontFamily="sans-serif"
android:gravity="start"
android:hint="#string/select_block"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/village"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/edittext_tint"
android:fontFamily="sans-serif"
android:hint="#string/select_village"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal">
<requestFocus />
</androidx.appcompat.widget.AppCompatEditText>
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/speech"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginRight="20dp"
android:adjustViewBounds="true"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:paddingBottom="5dp"
android:src="#drawable/mic" />
</RelativeLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="#drawable/button_background"
android:fontFamily="sans-serif"
android:foreground="?attr/selectableItemBackground"
android:padding="10dp"
android:text="Next"
android:textColor="#color/white"
android:textSize="17sp"
android:textStyle="normal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
android:fontFamily="sans-serif"
android:foreground="?attr/selectableItemBackground"
android:gravity="bottom"
android:text="#string/already_account"
android:textColor="#color/textview_black"
android:textSize="14sp"
android:textStyle="normal" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
android:fontFamily="sans-serif"
android:foreground="?attr/selectableItemBackground"
android:gravity="bottom"
android:text="#string/login_text"
android:textColor="#color/colorPrimaryDark"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
This is my Onclicklistener
private RelativeLayout select_back;
select_back = findViewById(R.id.select_back);
select_back.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent intent = new Intent(RegisterActivity.this,
LanuageActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
}
});
I am trying to figure out what is wrong with it but not getting any clue. Could you please help me in figuring out the issue? this is my whole layout part.
Your scrollview overlap the relativelayout so you cannot get click event, just change the sequence and it will works.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:fillViewport="false">
<LinearLayout
android:id="#+id/linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginRight="20dp"
android:orientation="vertical"
android:paddingBottom="20dp">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:src="#drawable/village_logo" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:fontFamily="sans-serif"
android:text="#string/village_title"
android:textColor="#color/title_colr"
android:textSize="20sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:backgroundTint="#color/edittext_tint"
android:focusable="true"
android:fontFamily="sans-serif"
android:gravity="start"
android:hint="#string/select_state"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/district"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/edittext_tint"
android:fontFamily="sans-serif"
android:gravity="start"
android:hint="#string/select_district"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/block"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/edittext_tint"
android:fontFamily="sans-serif"
android:gravity="start"
android:hint="#string/select_block"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/village"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/edittext_tint"
android:fontFamily="sans-serif"
android:hint="#string/select_village"
android:inputType="text"
android:padding="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#color/textview_black"
android:textColorHint="#color/textview_black"
android:textCursorDrawable="#null"
android:textSize="14sp"
android:textStyle="normal">
<requestFocus />
</androidx.appcompat.widget.AppCompatEditText>
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/speech"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginRight="20dp"
android:adjustViewBounds="true"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:paddingBottom="5dp"
android:src="#drawable/mic" />
</RelativeLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="#drawable/button_background"
android:fontFamily="sans-serif"
android:foreground="?attr/selectableItemBackground"
android:padding="10dp"
android:text="Next"
android:textColor="#color/white"
android:textSize="17sp"
android:textStyle="normal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
android:fontFamily="sans-serif"
android:foreground="?attr/selectableItemBackground"
android:gravity="bottom"
android:text="#string/already_account"
android:textColor="#color/textview_black"
android:textSize="14sp"
android:textStyle="normal" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
android:fontFamily="sans-serif"
android:foreground="?attr/selectableItemBackground"
android:gravity="bottom"
android:text="#string/login_text"
android:textColor="#color/colorPrimaryDark"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/select_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginTop="20dp"
android:background="#color/white"
android:clickable="true"
android:focusable="true">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:drawableStart="#drawable/left_arrow"
android:drawablePadding="10dp"
android:focusable="false"
android:fontFamily="sans-serif"
android:text="#string/village_text"
android:textColor="#color/colorPrimaryDark"
android:textSize="15sp"
android:textStyle="normal">
</androidx.appcompat.widget.AppCompatTextView>
</RelativeLayout>
Thats not a good thing to assign setOnClickListener into a Parent class in xml, but if you want to make it work you need to declare the private RelativeLayout select_back; as global place it on the top of protected void onCreate(Bundle savedInstanceState)
So I came to know that my scroll view layout was overlapping my Relative Layout. I put this Relative Layout inside Scrollview and now it's working like a charm.

layout not going all the way to the bottom

I am new to designing layouts , and i am trying to make this layout resizable with
android:windowSoftInputMode="adjustResize"
everything is working perfectly but the problem is i can't get the last relative layout to go all the way to the bottom
i tried to set gravity to bottom but it did not work
i added a line in my code where my problem occurs
here is my activity layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="#000000"
tools:context=".testLayout">
<RelativeLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/logoLayout"
>
<ImageView
android:layout_width="140dp"
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/nlogo">
</ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/logoLayout1"
android:layout_below="#id/logoLayout"
>
<EditText
android:id="#+id/testUsernameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Username"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testPasswordText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Password"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testEmailText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Email"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testFullNameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Full Name"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:text="Sign Up"
android:background="#drawable/rounded_button"
/>
</LinearLayout>
<!-- here is the problem -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/logoLayout1"
android:id="#+id/footerLayout"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="false"
android:text="Welcome to ....."
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
many thanks in advance
I have tried your layout in my temporary activity and adding android:fillViewport="true" in the ScrollView worked for me.
Here is the solution:
Add this line in Manifest file for your activity
android:windowSoftInputMode="adjustResize"
I have bit modified the XML file code to make it very easy to read and less view hierarchy.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:fillViewport="true">
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="140dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/ic_eye"
android:contentDescription="#null" />
<EditText
android:id="#+id/testUsernameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Username"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testPasswordText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Password"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testEmailText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Email"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testFullNameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Full Name"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="50dp"
android:background="#drawable/shape_calendar_bg"
android:text="Sign Up" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:text="Welcome to ....."
android:textColor="#color/colorTextWhite"
android:textSize="15sp" />
</LinearLayout>
</ScrollView>
While the keyboard is open

Is it possible to manage the tooltip in widget.TextInputLayout

As Edittext it is not the only one in the group widget. With TextInputLayout the hint didn't work. Tell me is there any way else to summon help?
This is my layout:
<android.support.design.widget.TextInputLayout
android:id="#+id/til_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:textColorHint="#color/colorTextHint">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/et_account_tint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/colorTextHint"
android:maxLines="1"
android:theme="#style/EditText"
android:textSize="16sp" />
<EditText
android:id="#+id/et_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:drawableRight="#mipmap/ic_selectcontact"
android:hint="#string/enter_phone_number_contact_name"
android:inputType="text"
android:maxLines="1"
android:textColorHint="#color/colorTextHint"
android:textSize="16sp"
android:theme="#style/EditText" />
<TextView
android:id="#+id/et_account_button"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#android:color/transparent"
android:onClick="#{presenter::onClick}"
android:textSize="16sp"
tools:ignore="LabelFor" />
</RelativeLayout>
</android.support.design.widget.TextInputLayout>
Do like this
<android.support.design.widget.TextInputLayout
android:id="#+id/til_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
app:hintEnabled="true" app:hintAnimationEnabled="false"
android:textColorHint="#color/colorTextHint">
<EditText
android:id="#+id/et_account_tint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/colorTextHint"
android:maxLines="1"
android:theme="#style/EditText"
android:textSize="16sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
app:hintEnabled="true"
app:hintAnimationEnabled="false"
android:textColorHint="#color/colorTextHint">
<EditText
android:id="#+id/et_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:drawableRight="#mipmap/ic_selectcontact" android:hint="#string/enter_phone_number_contact_name"
android:inputType="text"
android:maxLines="1"
android:textColorHint="#color/colorTextHint"
android:textSize="16sp"
android:theme="#style/EditText" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/et_account_button"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#android:color/transparent"
android:onClick="#{presenter::onClick}"
android:textSize="16sp"
tools:ignore="LabelFor" />

Not able to scroll my Linear Layout using ScrollView?

This is my XML file for presenting the Layout.
edit_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/login_bg">
<LinearLayout
android:id="#+id/ll_userregisteration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="30dp"
android:isScrollContainer="true"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
<com.shout.networking.view.RoundedImageView
android:id="#+id/profile_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="center"
android:src="#drawable/profile_placeholder"/>
<ImageButton
android:id="#+id/camera"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="What do we call you"
android:textColor="#color/white"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/et_reg_Fname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:textSize="16sp"
android:layout_weight="1"
android:backgroundTint="#color/white"
android:hint="first name"
android:textColor="#color/white"
android:textColorHint="#7c7875" />
<EditText
android:id="#+id/et_reg_Lname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:textSize="16sp"
android:backgroundTint="#color/white"
android:hint="last name"
android:textColor="#color/white"
android:textColorHint="#7c7875" />
</LinearLayout>
<RadioGroup
android:id="#+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/rb_male"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:checked="true"
android:drawableLeft="#drawable/selector_radio_button"
android:drawablePadding="10dp"
android:text="Male"
android:textColor="#android:color/white"
android:textSize="18sp" />
<RadioButton
android:id="#+id/rb_female"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:checked="false"
android:drawableLeft="#drawable/selector_radio_button"
android:drawablePadding="10dp"
android:text="Female"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RadioGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="School of your cool"
android:textColor="#color/white"
android:textSize="18sp" />
<EditText
android:id="#+id/et_university"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/white"
android:textSize="14sp"
android:hint="add your university"
android:textColor="#color/white"
android:textColorHint="#7c7875" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="what you call home"
android:textColor="#color/white"
android:textSize="18sp" />
<EditText
android:id="#+id/et_livingaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/white"
android:hint="Where do you live now"
android:textColor="#color/white"
android:textSize="16sp"
android:textColorHint="#7c7875" />
<EditText
android:id="#+id/et_permanentaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/white"
android:hint="Where do you belong to"
android:textSize="16sp"
android:textColor="#color/white"
android:textColorHint="#7c7875" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Whats Your Calling"
android:textColor="#color/white"
android:textSize="18sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/et_interset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/white"
android:layout_toLeftOf="#+id/sp_interset"
android:hint="Type in your calling/pick from the list"
android:textSize="16sp"
android:maxLength="30"
android:textColor="#color/white"
android:textColorHint="#7c7875"
android:maxLines="1" />
<Spinner
android:id="#+id/sp_interset"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:layout_centerVertical="true"
android:background="#drawable/down_thicker"
android:dropDownWidth="250dp"
android:backgroundTint="#android:color/white"
android:popupBackground="#4b4b49"
android:spinnerMode="dropdown" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:layout_marginTop="10dp">
<Button
android:id="#+id/btn_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/selector_signup_button"
android:text="CANCEL"
android:layout_marginRight="20dp"
android:textColor="#color/black"
android:layout_weight="1"
android:textSize="15sp" />
<Button
android:id="#+id/btn_save"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/selector_signup_button"
android:text="SAVE"
android:textColor="#color/black"
android:layout_weight="1"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
This is the screenshot for my Layout.I am not able to scroll it.
I have put my Linear LAyout in the ScrollView but then also i am unable to get the scroll functionality in my xml design .
make changes in LinearLayout height to match_parent. it will work.
In ScrollView try adding this line:
app:layout_behavior="#string/appbar_scrolling_view_behavior"

Android: layout_below and layout_alignParentBottom

So I have the following layout
ScrollView
RelativeLayout
TextView1
EditText1
TextView2
EditText2
TextView3
EditText3
TextView4
EditText4
TextView5
EditText5:
android:id="#+id/txtPassword"
LinearLayout:
android:id="#+id/Linearlayout1"
layout_alignParentBottom="true"
Button1
Button2
Here's the problem
When I click the txtPassword EditText to enter some text Button1&Button2 from the LinearLayout overlaps or becomes on top of txtPassword
Someone suggested that I use android:layout_below="#id/txtPassword" for the Linear Layout but that makes the layout_alignParentBottom="true" useless because it will put the LinearLayout right below txtPassword and not at the bottom.
EDIT: Here's the Full Layout
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/signatureScroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:id="#+id/signatureLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:text="#string/Meaning"
android:textColor="#000"
android:textSize="14sp" />
<EditText
android:id="#+id/txtMeaning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/textView1"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:enabled="false"
android:inputType="text|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/txtMeaning"
android:layout_marginTop="16dp"
android:text="#string/Comments"
android:textColor="#000"
android:textSize="14sp" />
<EditText
android:id="#+id/txtSignatureComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView01"
android:layout_below="#+id/TextView01"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="#string/Comments"
android:inputType="textMultiLine"
android:maxLength="250"
android:singleLine="false"
android:textSize="14sp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/textView1"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<ImageView
android:id="#+id/ImageView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView01"
android:layout_below="#+id/TextView01"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<TextView
android:id="#+id/txtDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtSignatureComments"
android:layout_marginTop="16dp"
android:text="#string/Duration2"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtDuration"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<EditText
android:id="#+id/txtHours"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/imgDuration"
android:layout_marginLeft="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="#string/Hours"
android:inputType="number|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<EditText
android:id="#+id/txtMinutes"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtHours"
android:layout_alignParentRight="true"
android:layout_marginRight="6dp"
android:ems="10"
android:hint="#string/Minutes"
android:inputType="numberDecimal|text|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/txtException"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtHours"
android:layout_marginTop="16dp"
android:text="#string/Exception"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgException"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtException"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<Spinner
android:id="#+id/spnrException"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imgException"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp" />
<EditText
android:id="#+id/txtExceptionDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/spnrException"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="8dp"
android:ems="10"
android:inputType="textMultiLine"
android:maxLength="250"
android:singleLine="false"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/txtPerformance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtExceptionDesc"
android:layout_marginTop="16dp"
android:text="#string/PerformanceBased"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtPerformance"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<Spinner
android:id="#+id/spnrPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/imgPerformance"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp" />
<EditText
android:id="#+id/txtUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/spnrPerformance"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="60dp"
android:ems="10"
android:hint="#string/Username"
android:inputType="textCapCharacters|textAutoComplete"
android:singleLine="true"
android:textAllCaps="true"
android:textSize="12sp" >
</EditText>
<EditText
android:id="#+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtUsername"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="#string/Password"
android:inputType="textPassword"
android:singleLine="true"
android:textSize="12sp" />
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="#+id/btnSave"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_detail_bg"
android:text="#string/Sign"
android:textColor="#drawable/button_detail_txt"
android:textSize="16sp"
android:textStyle="bold" />
<Button
android:id="#+id/btnCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_detail_bg"
android:text="#string/Cancel"
android:textColor="#drawable/button_detail_txt"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
You might want to see if this can be fixed using different windowSoftInputMode settings. You could try to set
android:windowSoftInputMode="adjustPan" for this specific activity. It will than move up the UI if the keyboard is visible and focused on a edittext.
adjustResize can have the effect that some views overlap when the keyboard is visible.
use android:layout_below="#id/txtPassword" for the LinearLayout will work and doesn't make alignparentbottom="true" useless.
try it
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout_below="#id/txtPassword"
android:layout_alignParentBottom="true" >
When you use a Relative Layout and the Keyboard will be opened you LinearLayout will be above the keyboard
I'll suggest another solution and I think it will work:
Use a LinearLayout as parent and the last LinearLayout height fill parent and set the gravity bottom try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/signatureScroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<LinearLayout
android:id="#+id/signatureLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="#string/Meaning"
android:textColor="#000"
android:textSize="14sp" />
<EditText
android:id="#+id/txtMeaning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:enabled="false"
android:inputType="text|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="16dp"
android:text="#string/Comments"
android:textColor="#000"
android:textSize="14sp" />
<EditText
android:id="#+id/txtSignatureComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="#string/Comments"
android:inputType="textMultiLine"
android:maxLength="250"
android:singleLine="false"
android:textSize="14sp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<ImageView
android:id="#+id/ImageView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<TextView
android:id="#+id/txtDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="16dp"
android:text="#string/Duration2"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<EditText
android:id="#+id/txtHours"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="#string/Hours"
android:inputType="number|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<EditText
android:id="#+id/txtMinutes"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtHours"
android:layout_gravity="right"
android:layout_marginRight="6dp"
android:ems="10"
android:hint="#string/Minutes"
android:inputType="numberDecimal|text|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/txtException"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="16dp"
android:text="#string/Exception"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgException"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<Spinner
android:id="#+id/spnrException"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp" />
<EditText
android:id="#+id/txtExceptionDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="8dp"
android:ems="10"
android:inputType="textMultiLine"
android:maxLength="250"
android:singleLine="false"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/txtPerformance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="16dp"
android:text="#string/PerformanceBased"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<Spinner
android:id="#+id/spnrPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp" />
<EditText
android:id="#+id/txtUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="60dp"
android:ems="10"
android:hint="#string/Username"
android:inputType="textCapCharacters|textAutoComplete"
android:singleLine="true"
android:textAllCaps="true"
android:textSize="12sp" >
</EditText>
<EditText
android:id="#+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtUsername"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="#string/Password"
android:inputType="textPassword"
android:singleLine="true"
android:textSize="12sp" />
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<Button
android:id="#+id/btnSave"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_detail_bg"
android:text="#string/Sign"
android:textColor="#drawable/button_detail_txt"
android:textSize="16sp"
android:textStyle="bold"
android:layout_gravity="bottom"
android:gravity="bottom" />
<Button
android:id="#+id/btnCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_detail_bg"
android:text="#string/Cancel"
android:textColor="#drawable/button_detail_txt"
android:textSize="16sp"
android:textStyle="bold"
android:layout_gravity="bottom"
android:gravity="bottom" />
</LinearLayout>
</LinearLayout>
</ScrollView>

Categories

Resources