i have Two EditText in login page.Only one visible at first Time.when we open the Activity request focus to first EditText and next button Comes below EditText.When we Click next button Second Edittext will be Visible.button is not Showing below the Second EditText.it hiding the Second Edittext. i want to show below the Second Editext here is my Code :
<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"
tools:context="com.valai.school.activities.LogInActivity">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/toolbar_title_login"
style="@style/Toolbar"
android:background="@color/colorPrimary"
android:gravity="center"
android:text="@string/signInBtnText"
android:textAllCaps="false"
android:textColor="@color/colorWhite"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<ImageView
android:id="@+id/imgLogo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="@id/toolbar_title_login"
android:layout_centerInParent="true"
android:layout_marginTop="25dp"
android:contentDescription="@string/app_name"
android:src="@mipmap/ic_launcher" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/imgLogo"
android:padding="15dp">
<EditText
android:id="@+id/edtUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="50dp"
android:background="@drawable/edit_text_style"
android:drawableLeft="@drawable/ic_user_name_24dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_user_name_24dp"
android:hint="@string/userNameHint"
android:inputType="textEmailAddress"
android:padding="10dp"
android:textColor="@android:color/black" />
<EditText
android:id="@+id/edtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/edtUserName"
android:layout_gravity="bottom"
android:layout_marginTop="15dp"
android:background="@drawable/edit_text_style"
android:drawableLeft="@drawable/ic_password_24dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_password_24dp"
android:hint="@string/passwordHint"
android:inputType="textPassword"
android:padding="10dp"
android:textColor="@android:color/black"
android:visibility="gone" />
<RadioGroup
android:id="@+id/radioGroupLogInAs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/edtPassword"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login_as"
android:textColor="@color/colorBlack"
android:textSize="16sp" />
<RadioButton
android:id="@+id/radioBtnAdmin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:checked="false"
android:text="@string/adminText"
android:textColor="@color/colorBlack"
android:textSize="16sp" />
<RadioButton
android:id="@+id/radioBtnParent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:gravity="center"
android:text="@string/parentText"
android:textColor="@color/colorBlack"
android:textSize="16sp" />
<RadioButton
android:id="@+id/radioBtnTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:checked="false"
android:text="@string/teacherText"
android:textColor="@color/colorBlack"
android:textSize="16sp" />
</RadioGroup>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
<Button
android:id="@+id/btnSignIn"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:text="@string/nextBtnText"
android:textAllCaps="true"
android:textColor="@color/colorWhite" />
Try the following:
<?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">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/btnSignIn"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/toolbar_title_login"
android:background="@color/colorPrimary"
android:gravity="center"
android:text="Sign In"
android:textAllCaps="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="RelativeOverlap" />
<ImageView
android:id="@+id/imgLogo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="@id/toolbar_title_login"
android:layout_centerInParent="true"
android:layout_marginTop="25dp"
android:contentDescription="@string/app_name"
android:src="@mipmap/ic_launcher" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/imgLogo"
android:layout_alignParentBottom="true"
android:padding="15dp">
<EditText
android:id="@+id/edtUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="50dp"
android:drawablePadding="10dp"
android:hint="EDT1"
android:inputType="textEmailAddress"
android:padding="10dp"
android:textColor="@android:color/black" />
<EditText
android:id="@+id/edtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/edtUserName"
android:layout_gravity="bottom"
android:layout_marginTop="15dp"
android:drawablePadding="10dp"
android:inputType="textPassword"
android:padding="10dp"
android:hint="EDT2"
android:textColor="@android:color/black"
android:visibility="gone" />
<RadioGroup
android:id="@+id/radioGroupLogInAs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/edtPassword"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login as"
android:textColor="@android:color/black"
android:textSize="16sp" />
<RadioButton
android:id="@+id/radioBtnAdmin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:checked="false"
android:text="Admin Text"
android:textColor="@android:color/black"
android:textSize="16sp" />
<RadioButton
android:id="@+id/radioBtnParent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:gravity="center"
android:text="Parent Text"
android:textColor="@android:color/black"
android:textSize="16sp" />
<RadioButton
android:id="@+id/radioBtnTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:checked="false"
android:text="Teacher Text"
android:textColor="@android:color/black"
android:textSize="16sp" />
</RadioGroup>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
<Button
android:id="@+id/btnSignIn"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:text="Next Button Text"
android:textAllCaps="true"
android:textColor="@android:color/white" />
</RelativeLayout>