I have a register layout. In this if I click on first edit text the keyboard appears and other views gets hidden under the keyboard. So I want to make the layout scrollable so we can scroll up and use the next edit text while the keyboard is popped up.
I tried to add the scroll view for this in layout. Also set this android:windowSoftInputMode="adjustResize" in manifest for the activity. But it makes all the views shift up , so all the layouts got merged with each other.
Following is the image what I got.
EDIT: Edited layout : Edited again.Still it works same.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/my_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout android:id="#+id/login" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="200dp"
android:layout_height="100dp"
android:id="#+id/imageView2"
android:src="#drawable/logo_1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true"
android:id="#+id/linearLayout5">
<LinearLayout android:layout_width="250dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayoutSecondName"
android:background="#drawable/field_1"
android:layout_below="#+id/imageView2"
android:layout_centerHorizontal="true">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:background="#drawable/user" />
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="40dp" android:hint="#string/user_id"
android:maxLines="1"
android:singleLine="true"
android:inputType="text"
android:layout_below="#+id/linearLayoutFirstName"
android:layout_toRightOf="#+id/linearLayoutFirstName"
android:layout_toEndOf="#+id/linearLayoutFirstName"
android:background="#android:color/transparent"
android:layout_marginLeft="20dp"
android:layout_gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout android:layout_width="250dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayoutFirstName"
android:layout_centerVertical="true"
android:layout_alignStart="#+id/linearLayoutSecondName"
android:layout_below="#+id/linearLayoutSecondName"
android:layout_marginTop="20dp"
android:background="#drawable/field_1">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView4"
android:layout_marginLeft="15dp"
android:background="#drawable/email"
android:layout_gravity="center" />
<EditText android:id="#+id/password" android:layout_width="match_parent"
android:layout_height="40dp" android:hint="EMAIL "
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:maxLines="1" android:singleLine="true"
android:layout_gravity="center"
android:layout_below="#+id/linearLayoutSecondName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:textSize="12sp"
android:inputType="textEmailAddress" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayout4"
android:background="#drawable/field_1"
android:layout_below="#+id/linearLayout5"
android:layout_alignRight="#+id/imageView2"
android:layout_alignEnd="#+id/imageView2"
android:layout_marginTop="20dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView5"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:background="#drawable/pass" />
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="#string/prompt_password"
android:maxLines="1"
android:singleLine="true"
android:inputType="textPassword|text"
android:layout_below="#+id/linearLayoutFirstName"
android:layout_toRightOf="#+id/linearLayoutFirstName"
android:layout_toEndOf="#+id/linearLayoutFirstName"
android:background="#android:color/transparent"
android:layout_marginLeft="20dp"
android:layout_gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayout6"
android:background="#drawable/field_1"
android:layout_below="#+id/linearLayout5"
android:layout_alignLeft="#+id/linearLayout5"
android:layout_alignStart="#+id/linearLayout5"
android:layout_marginTop="20dp">
<ImageView
android:layout_width="15dp"
android:layout_height="25dp"
android:id="#+id/imageView6"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:background="#drawable/phone" />
<EditText
android:layout_width="30dp"
android:layout_height="match_parent"
android:inputType="number"
android:ems="10"
android:id="#+id/editText"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="+91"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background = "#android:color/darker_gray"
android:layout_marginTop="05dp"
android:layout_marginBottom="05dp">
</View>
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="MOBILE NO"
android:maxLines="1"
android:singleLine="true"
android:layout_below="#+id/linearLayoutFirstName"
android:layout_toRightOf="#+id/linearLayoutFirstName"
android:layout_toEndOf="#+id/linearLayoutFirstName"
android:background="#android:color/transparent"
android:layout_gravity="center"
android:textSize="12sp"
android:layout_marginLeft="05dp"
android:inputType="number" />
</LinearLayout>
</LinearLayout>
<Button android:id="#+id/sign_up_button"
android:layout_width="match_parent" android:layout_height="40dp"
android:text="SIGN UP"
android:textSize="14sp"
android:textColor="#android:color/white"
style="?android:attr/borderlessButtonStyle"
android:layout_gravity="left"
android:background="#drawable/rounded_shape"
android:layout_alignParentBottom="false"
android:layout_alignRight="#+id/linearLayout5"
android:layout_alignEnd="#+id/linearLayout5"
android:layout_alignLeft="#+id/linearLayout5"
android:layout_alignStart="#+id/linearLayout5"
android:layout_below="#+id/linearLayout5"
android:layout_marginTop="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="#string/register"
android:id="#+id/alreadyRegistered"
android:focusable="false"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:textColorLink="#android:color/darker_gray"
android:textIsSelectable="true"
android:textSize="14sp"
android:layout_marginBottom="10dp"
android:textAlignment="center" />
</RelativeLayout>
</ScrollView>
How to do this?
Doing same with another layout, but in this when I click on first edit text , the first edit text also scrolls up while the keyboard is popped up. What's wrong here? Used this too.
android:windowSoftInputMode="stateHidden|adjustResize"
fragment :
<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/my_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/linearLayout5"
android:layout_gravity="center"
android:layout_centerHorizontal="true">
<LinearLayout android:layout_width="300dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayoutFirstName"
android:layout_below="#+id/linearLayoutSecondName"
android:background="#drawable/field_1"
android:layout_marginTop="20dp">
<EditText android:id="#+id/password" android:layout_width="match_parent"
android:layout_height="40dp" android:hint="First Name"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:maxLines="1" android:singleLine="true"
android:layout_gravity="center"
android:layout_below="#+id/linearLayoutSecondName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:textSize="12sp"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayoutSecondName"
android:background="#drawable/field_1"
android:layout_below="#+id/linearLayout5"
android:layout_alignRight="#+id/imageView2"
android:layout_alignEnd="#+id/imageView2"
android:layout_marginTop="20dp">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Last Name"
android:maxLines="1"
android:singleLine="true"
android:inputType="text"
android:layout_below="#+id/linearLayoutFirstName"
android:layout_toRightOf="#+id/linearLayoutFirstName"
android:layout_toEndOf="#+id/linearLayoutFirstName"
android:background="#android:color/transparent"
android:layout_marginLeft="20dp"
android:layout_gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:id="#+id/linearLayoutDOB"
android:background="#drawable/field_1"
android:layout_below="#+id/linearLayout5"
android:layout_alignLeft="#+id/linearLayout5"
android:layout_alignStart="#+id/linearLayout5"
android:layout_marginTop="20dp">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Date Of Birth"
android:singleLine="true"
android:layout_below="#+id/linearLayoutFirstName"
android:layout_toRightOf="#+id/linearLayoutFirstName"
android:layout_toEndOf="#+id/linearLayoutFirstName"
android:background="#android:color/transparent"
android:layout_gravity="center"
android:textSize="12sp"
android:layout_marginLeft="20dp"
android:inputType="date" />
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="40dp"
android:id="#+id/linearLayoutLocation"
android:layout_below="#+id/linearLayoutSecondName"
android:background="#drawable/field_1"
android:layout_marginTop="20dp"
android:layout_gravity="center">
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Location"
android:maxLines="1"
android:singleLine="true"
android:layout_gravity="center"
android:layout_below="#+id/linearLayoutSecondName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:textSize="12sp"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="40dp"
android:id="#+id/linearLayoutAnniversary"
android:layout_below="#+id/linearLayoutSecondName"
android:background="#drawable/field_1"
android:layout_marginTop="20dp"
android:layout_gravity="center">
<EditText
android:id="#+id/editText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Anniversary"
android:maxLines="1"
android:singleLine="true"
android:layout_gravity="center"
android:layout_below="#+id/linearLayoutSecondName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:textSize="12sp"
android:inputType="date" />
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="40dp"
android:id="#+id/linearLayout8"
android:layout_below="#+id/linearLayoutSecondName"
android:background="#drawable/field_1"
android:layout_marginTop="20dp"
android:layout_gravity="center">
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Identify Family Members In Contacts"
android:maxLines="1"
android:singleLine="true"
android:layout_gravity="center"
android:layout_below="#+id/linearLayoutSecondName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:textSize="12sp"
android:inputType="text" />
</LinearLayout>
<Button android:id="#+id/sign_up_button"
android:layout_width="300dp" android:layout_height="40dp"
android:text="SUBMIT"
android:textColor="#android:color/white"
android:textSize="14sp"
style="?android:attr/borderlessButtonStyle"
android:layout_gravity="center_horizontal|bottom"
android:background="#drawable/rounded_shape"
android:layout_alignParentBottom="false"
android:layout_alignRight="#+id/linearLayout5"
android:layout_alignEnd="#+id/linearLayout5"
android:layout_alignLeft="#+id/linearLayout5"
android:layout_alignStart="#+id/linearLayout5"
android:layout_below="#+id/linearLayout5"
android:layout_marginTop="40dp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
UseScroll View as Your Root Layout.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
Also add this to your Manifest.
<activity android:name="YourActivity"
android:windowSoftInputMode="adjustResize" />
You have to change your layout root to ScrollView Instead of RelativeLayout
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/my_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<!--Your layout components-->
<!--Your layout components-->
</ScrollView
In your manifest.xml add this to your activity
android:windowSoftInputMode="stateHidden|adjustPan"
Related
I know it is silly question but i used many solution which already given by stack Overflow but no one solve my problem, my question is, I want to Scroll Up the layout after clicking on last edittext because keyboard hide the EditText and i am unable to see what is typing..
Code I am using in onCreate method
scrollView=(ScrollView)findViewById(R.id.activityRoot);
addressEdt=(EditText)findViewById(R.id.profilAddress);
addressEdt.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
scrollView.fullScroll(ScrollView.FOCUS_UP);
}
});
My xml code is
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:id="#+id/activityRoot">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/colorWhite">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="10dp"
android:id="#+id/linearLayout7">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/driverName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center|bottom"
android:layout_marginTop="90dp"
android:gravity="center"
android:padding="5dp"
android:text="Kevin Michaels"
android:textSize="18dp" />
<TextView
android:id="#+id/total_rides_editProfile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center|bottom"
android:layout_marginTop="140dp"
android:gravity="center"
android:padding="5dp"
android:text=""
android:textSize="17dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="#+id/userProfileImageView"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="center_horizontal|top"
android:scaleType="centerCrop"
android:src="#drawable/profile_user_icon" />
<ProgressBar
android:id="#+id/profileImageProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp" />
<ImageView
android:id="#+id/userChangePhotoButton"
android:layout_width="37dp"
android:layout_height="37dp"
android:layout_gravity="right|top"
android:src="#drawable/camera_icon" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_below="#+id/linearLayout7">
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:hint="Username"
android:paddingLeft="15dp"
android:paddingRight="60dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:maxLength="20"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
style="#style/ProfileUserNameEditText"
android:singleLine="true"
android:id="#+id/txtprofileUserName"/>
<EditText
style="#style/ProfileMobileNumberEditText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="#+id/profileMobile"
android:layout_gravity="center_horizontal"
android:hint="Mobile"
android:paddingLeft="15dp"
android:paddingRight="60dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:maxLength="10"
android:singleLine="true"
android:inputType="phone|textPhonetic"/>
<EditText
style="#style/ProfileAddressEditText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="#+id/profilAddress"
android:layout_gravity="center_horizontal"
android:hint="Address"
android:inputType="text"
android:paddingLeft="15dp"
android:paddingRight="60dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:singleLine="true"
android:maxLines="1"
android:drawableLeft="#drawable/edit_profile_address"
android:maxLength="40"
/>
<TextView
style="#style/ProfileEmailEditText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="#+id/profileEmail"
android:layout_gravity="center_horizontal"
android:hint="Email"
android:paddingLeft="15dp"
android:paddingRight="60dp"
android:layout_marginTop="7dp"
android:gravity="center"
android:singleLine="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/saveProfileButton"
android:background="#drawable/a_log_in_button"
android:text="Done"
android:textColor="#color/white"
android:layout_marginTop="10dp"
android:textSize="17dp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
I have a layout with Text,2 Spinners, 1 EditText and 1 Button on the end. When i want to enter something in EditText that button get covered by Keyboard.
This is Fragment not Activity if it's making any difference.
<?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="fill_parent"
android:background="#color/transparentlightgrey">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/SectionName"
android:layout_width="fill_parent"
android:layout_height="56dp"
android:background="#color/neonGreen"
android:textColor="#C6D600"
android:textSize="20sp"
android:textStyle="normal|bold">
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="Add Credit"
android:textColor="#color/lightGrey"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/AddPointsHolder"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:orientation="vertical">
<Spinner
android:id="#+id/spinneroperater"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="#d8d8d8"
android:spinnerMode="dialog" />
<Spinner
android:id="#+id/spinnerTopUp"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="#d8d8d8"
android:spinnerMode="dialog"
android:touchscreenBlocksFocus="false" />
<EditText
android:id="#+id/phoneNumber"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_below="#+id/linearLayout"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/edit_text_border"
android:ems="10"
android:hint="Enter Phone number"
android:inputType="number"
android:maxLength="12"
android:paddingLeft="5dp"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="18dp" />
</LinearLayout>
<TextView
android:id="#+id/AddPointsHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/SectionName"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:text="#string/addPoints"
android:textColor="#ffffff" />
<Button
android:id="#+id/addPoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_button_clickable"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Add Credit" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
adjustPan doesn't resize the screen. Since you have a scrolling view, you should be using adjustResize.
From the docs on adjustPan:
The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
Do this.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:background="#color/white"
android:orientation="vertical">
<ScrollView
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Credit"
android:id="#+id/textView14"
android:textColor="#color/lightGrey"
android:textSize="20dp"
android:textStyle="bold"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginLeft="10dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/AddPointsHolder"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/linearLayout"
android:layout_marginTop="10dp">
<Spinner
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="#+id/spinneroperater"
android:spinnerMode="dialog"
android:layout_weight="1"
android:background="#d8d8d8"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="#+id/spinnerTopUp"
android:spinnerMode="dialog"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:background="#d8d8d8"
android:touchscreenBlocksFocus="false"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp" />
<EditText
android:layout_width="fill_parent"
android:layout_height="40dp"
android:inputType="number"
android:ems="10"
android:id="#+id/phoneNumber"
android:hint="Enter Phone number"
android:background="#drawable/edit_text_border"
android:textSize="18dp"
android:paddingLeft="5dp"
android:layout_below="#+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:maxLength="12"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#ffffff"
android:textColorHint="#ffffff" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/addPoints"
android:id="#+id/AddPointsHolder"
android:layout_below="#+id/SectionName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#ffffff" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Credit"
android:id="#+id/addPoints"
android:layout_below="#+id/linearLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_button_clickable"
android:paddingRight="10dp"
android:paddingLeft="10dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
First of all this is the code
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#color/com_facebook_blue"
android:fadeScrollbars="false"
android:fillViewport="true"
tools:context="com.example.Test.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:isScrollContainer="true"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:weightSum="4">
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:layout_gravity="top"
android:scaleType="fitXY"
android:textColor="#android:color/black" />
<RelativeLayout
android:id="#+id/level2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:layout_gravity="bottom"
android:background="#e0e0e0"
android:orientation="vertical">
<ProgressBar
android:id="#+id/progressBar2"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="5dp"
android:background="#android:color/black"
android:gravity="center"
android:visibility="gone">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#android:color/black"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rela"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#e0e0e0">
<ImageButton
android:id="#+id/deleteButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#mipmap/ruhesi_delete"
/>
<ImageButton
android:id="#+id/writeButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_toEndOf="#+id/deleteButton"
android:layout_toRightOf="#+id/deleteButton"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#mipmap/ruhesi_add" />
<ImageButton
android:id="#+id/writeButtons"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_toEndOf="#+id/deleteButton"
android:layout_toRightOf="#+id/deleteButton"
android:background="#color/transparent"
android:scaleType="fitXY"
android:src="#mipmap/ruhesi_confirm"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/temelbilgiler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rela"
android:background="#e0e0e0"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin">
<TextView
android:id="#+id/temelBilgilerInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:text="#string/temelbilgileriinfo"
android:textColor="#android:color/black"
android:textSize="20dp" />
<View
android:id="#+id/layout_root"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/temelBilgilerInfo"
android:background="#drawable/ruhesi_lines" />
<EditText
android:id="#+id/birthday_edit"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/layout_root"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthday"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit1"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthday"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit2"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit1"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthday"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit3"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit2"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthday"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit4"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit3"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthday1"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit5"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit4"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthday123213"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit6"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit5"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthdayasdasdasd"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
<EditText
android:id="#+id/birthday_edit7"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="#+id/birthday_edit6"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:ellipsize="start"
android:ems="10"
android:gravity="center_horizontal"
android:hint="Enter Birthdayasdasdasd"
android:inputType="date"
android:textColor="#000000"
android:textColorHint="#DDAAAAAA" />
</RelativeLayout>
<com.isseiaoki.simplecropview.CropImageView
android:id="#+id/cropImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
custom:backgroundColor="#color/base"
custom:cropMode="ratio_4_3"
custom:frameColor="#color/frame"
custom:frameStrokeWeight="1dp"
custom:guideColor="#color/guide"
custom:guideShowMode="show_on_touch"
custom:guideStrokeWeight="1dp"
custom:handleColor="#color/handle"
custom:handleShowMode="show_always"
custom:handleSize="8dp"
custom:minFrameSize="150dp"
custom:overlayColor="#color/overlay"
custom:touchPadding="8dp" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_gravity="bottom"
android:background="#color/black"
android:visibility="gone">
<LinearLayout
android:id="#+id/thumbnails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="2dp">
<ImageView
android:id="#+id/animatedGifImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
</LinearLayout>
</ScrollView>
In this case this image occurs: Scroll does not work here.
Scroll does not work here
Now when I do wrap_content at layout_height of the scrollview then the scrollview works.
The issue then the blue screen part dissappears (viewpager place)
I need that placeholder because there will be image there.
I cannot give fix height for the viewpager because in each device there is different sizes. Thats why I use layout_weight.
How I can have this scroll working and also keep this blue colored place as spaceholder.
I would try setting either height or width of layout to 0 and then layout weight on whichever one you want to give weight to (height or width). I am a beginner so this might not work in your case however, it looks like it may be an issue if not THE issue.
In my application i am using recycler view and scrollview in one layout. it is not working when i am using both these views. If i remove scroll view only the recycler view is working. Plese any one help me hoe to fix this issue.
my code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/r1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background"
>
<ScrollView
android:id="#+id/sc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1e356a">
<TextView
android:id="#+id/placce_head"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Hyderabad to banglore"
android:textColor="#ffffff"
android:textSize="20dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#78869c"
android:weightSum="2"
android:orientation="horizontal">
<TextView
android:id="#+id/seats"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="Selected Seats"
android:textColor="#ffffff"
android:textSize="16dp" />
<TextView
android:id="#+id/totalamount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="Total Amount"
android:textColor="#ffffff"
android:textSize="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#78869c"
android:weightSum="2"
android:orientation="horizontal">
<TextView
android:id="#+id/seat_num"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:textColor="#ffffff"
android:textSize="16dp" />
<TextView
android:id="#+id/total_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#ffffff"
android:textSize="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/boardingpoint_edttxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:layout_marginLeft="30dp"
android:layout_marginTop="22dp"
android:background="#null"
android:hint=" Select Boarding Point"
android:textColorHint="#1e365a"
android:textSize="15dp" />
<View
android:layout_width="fill_parent"
android:layout_height="0.8dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="7dp"
android:background="#1e365a" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#78869c"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/contact_details"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Contact Details"
android:textColor="#ffffff"
android:textSize="20dp" />
</RelativeLayout>
<EditText
android:id="#+id/contactname_edt_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="22dp"
android:background="#null"
android:hint="Contact Name"
android:textColorHint="#1e365a"
android:textSize="15dp" />
<View
android:layout_width="fill_parent"
android:layout_height="0.8dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="7dp"
android:background="#1e365a" />
<EditText
android:id="#+id/email_edt_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="22dp"
android:background="#null"
android:hint="Email Address"
android:textColorHint="#1e365a"
android:textSize="15dp" />
<View
android:layout_width="fill_parent"
android:layout_height="0.8dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="7dp"
android:background="#1e365a" />
<EditText
android:id="#+id/contactnum_edt_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="22dp"
android:background="#null"
android:hint="Contact Number"
android:textColorHint="#1e365a"
android:textSize="15dp" />
<View
android:layout_width="fill_parent"
android:layout_height="0.8dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="7dp"
android:background="#1e365a" />
<EditText
android:id="#+id/emergency_edt_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="22dp"
android:background="#null"
android:hint="Emergency Contact Number"
android:textColorHint="#1e365a"
android:textSize="15dp" />
<View
android:layout_width="fill_parent"
android:layout_height="0.8dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="7dp"
android:background="#1e365a" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#78869c"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/passenger_details"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Passenger Details"
android:textColor="#ffffff"
android:textSize="20dp" />
</RelativeLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/view"
android:layout_below="#+id/sc"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<LinearLayout
android:id="#+id/coupon_lay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="8dp"
android:layout_marginTop="12dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100" >
<EditText
android:id="#+id/entercouponcode_edt"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_weight="50"
android:hint="Enter coupn code"
android:inputType="text" >
<requestFocus />
</EditText>
<Button
android:id="#+id/bt_apply"
style="#style/payment_button_style"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="-5dp"
android:layout_weight="40"
android:gravity="center"
android:text="Apply" />
</LinearLayout>
<Button
android:id="#+id/pay_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="28dp"
android:layout_marginRight="30dp"
android:layout_marginTop="20dp"
android:background="#F93249"
android:duplicateParentState="true"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:text="Proceed to Pay"
android:textColor="#ffffff"
android:textSize="20dp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
you must know that ,your scrollview property is set as MatchParent ,which means it will fill the content view, so i suggest to set Height a real value such as 100dp, and it will work
You need to dynamically change the height of the recyclerview, depending on how many items you have.
int recyclerheight = height_per_item * adapterData.size();
recyclerView.getLayoutParams().height = recyclerheight;
The scroll view blocks the recyclerview from changing its height set in the xml, that's why you need to do it programically.
I cannot widen buttons on my Android project. I'm only having an issue with one of them.
This is what I'm getting
And this is what I want
Only the buttons. Here is my XML for the corresponding issue.
<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="#4ECDC4"
tools:context=".MainActivity" >
<RelativeLayout
android:id="#+id/rlSignInForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="36dp" >
<LinearLayout
android:id="#+id/llSignInBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="visible"
android:weightSum="2" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignInEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etSignInEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivEmailIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivPasswordIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignInPassword"
android:layout_marginBottom="3dp"/>
<EditText
android:id="#+id/etSignInPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivPasswordIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llSignUpBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="visible"
android:weightSum="3" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivUserNameIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/username_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpName"/>
<EditText
android:id="#+id/etSignUpName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivUserNameIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/username"
android:singleLine="true"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etSignUpEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivEmailIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivPasswordIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpPassword"
android:layout_marginBottom="3dp"/>
<EditText
android:id="#+id/etSignUpPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivPasswordIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llForgotPasswordBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:weightSum="2"
android:visibility="gone" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etForgotPasswordEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etForgotPasswordEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivEmailIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<Button
android:id="#+id/btnForgotPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/rlSignInForm"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#null"
android:text="#string/forgot_password"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<Button
android:id="#+id/btnSendPassword"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_below="#+id/rlSignInTitle"
android:layout_centerHorizontal="true"
android:layout_marginTop="180dp"
android:background="#drawable/rounded_rect_positive_selector"
android:gravity="center"
android:text="#string/SEND_PASSWORD"
android:textColor="#android:color/white"
android:textStyle="bold"
android:width="175dp"
android:height="55dp"
android:visibility="gone" />
<Button
android:id="#+id/btnActive"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_alignLeft="#+id/btnInactive"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/rlSignInTitle"
android:layout_marginTop="280dp"
android:background="#AD5BDB"
android:gravity="center"
android:text="#string/SIGN_IN"
android:textColor="#android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:visibility="visible" />
<Button
android:id="#+id/btnInactive"
style="#style/AppTheme"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_alignLeft="#+id/rlSignInForm"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/btnActive"
android:layout_marginTop="14dp"
android:background="#AD58DB"
android:gravity="center"
android:text="#string/SIGN_UP"
android:textColor="#android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/rlNoInternetNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:visibility="gone" >
<include layout="#layout/no_internet_notification" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlPushNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:visibility="gone" >
<include layout="#layout/push_notification" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlSignInTitle"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#4ECDC4" >
<com.cloverstudio.spika.view.MyriadProTextView
android:id="#+id/tvSignInTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/SIGN_IN"
android:textColor="#android:color/white"
android:textSize="26sp" />
</RelativeLayout>
</RelativeLayout>
The smaller button is btnSendPassword and the other button is btnActive. I've tried playing with the widths but nothing changed. I'm fairly new so any explaination why this is happening would be good, so then I know whats wrong if it happens again.Any help would be wonderful.
You should align your btnSendPassword button with rlSignInForm for both left and right...then you will achieve your requirement. Replace the following XML snippet of btnSendPassword with your existing XML snippet of btnSendPassword...you will get all the problem solved.
<Button
android:id="#+id/btnSendPassword"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_below="#+id/rlSignInTitle"
android:layout_alignLeft="#+id/rlSignInForm"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_marginTop="180dp"
android:background="#drawable/rounded_rect_positive_selector"
android:gravity="center"
android:text="#string/SEND_PASSWORD"
android:textColor="#android:color/white"
android:textStyle="bold"
android:visibility="gone" />
Set android:layout_width="match_parent". This should solve your problem.