Android scrollview with viewpager layout_weight issue - android

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.

Related

ScrollView.FOCUS_UP not working in my project with root layout as scrollView

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>

RelativeLayout does not expand with the heights of view elements

I have Relative layout the is set to wrap_content in height. It has 2 TextView and 2 EditText. However, the RelativeLayout does not match to the height of EditTexts.
Dashed Rectangle is the region highlighted by android studio preview tool as the borders of RelativeLayout.
The actual problem is that when I run the app the bottom edittext kind of goes below the Relative layout and so its bottom part disappears. Thereby, user can't see that bottom line and don't know that there is a textfield.
Android Studio Preview:
Problem and Result on Emulator:
XML file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="5" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/numberOfDaysTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="#string/initialNumberOfDays"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="58sp" />
<TextView
android:id="#+id/daysText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/numberOfDaysTextView"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="#string/daysText"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
</RelativeLayout>
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="3" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/fromDatePickerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="#string/fromTextView"
android:textSize="15sp" />
<EditText
android:id="#+id/fromDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/fromDatePickerTextView"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:layout_toEndOf="#+id/fromDatePickerTextView"
android:layout_toRightOf="#+id/fromDatePickerTextView"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
<TextView
android:id="#+id/toDatePickerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/fromDatePickerTextView"
android:layout_alignRight="#+id/fromDatePickerTextView"
android:layout_below="#+id/fromDatePickerTextView"
android:layout_marginTop="32dp"
android:text="#string/toTextView"
android:textSize="15sp" />
<EditText
android:id="#+id/toDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/toDatePickerTextView"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:layout_marginTop="22dp"
android:layout_toEndOf="#+id/toDatePickerTextView"
android:layout_toRightOf="#+id/toDatePickerTextView"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/calculateDaysButton"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:layout_marginTop="40dp"
android:background="#drawable/button_bg"
android:text="#string/calculateButtonText"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
EDIT: Another solution that has worked:
TextView must be aligned to baseline of EditText and not the reverse way!
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/fromDatePickerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignBaseline="#+id/fromDate"
android:text="#string/fromTextView"
android:textSize="15sp" />
<EditText
android:id="#+id/fromDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:layout_toEndOf="#+id/fromDatePickerTextView"
android:layout_toRightOf="#+id/fromDatePickerTextView"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
<TextView
android:id="#+id/toDatePickerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/fromDatePickerTextView"
android:layout_alignRight="#+id/fromDatePickerTextView"
android:layout_alignBaseline="#+id/toDate"
android:layout_marginTop="32dp"
android:text="#string/toTextView"
android:textSize="15sp" />
<EditText
android:id="#+id/toDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="#+id/toDatePickerTextView"
android:layout_toRightOf="#+id/toDatePickerTextView"
android:layout_below="#+id/fromDate"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
</RelativeLayout>
You should use Linear Layout instead of Relative Layout.
Check out below code i have done some modification and applied with Linear Layout. You can modify with margin , height , width.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="5" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/numberOfDaysTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="0"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="58sp" />
<TextView
android:id="#+id/daysText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/numberOfDaysTextView"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Day"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
</RelativeLayout>
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="3" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/fromDatePickerTextView"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:text="to"
android:textSize="15sp" />
<EditText
android:id="#+id/fromDate"
android:layout_width="130dp"
android:layout_height="45dp"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/toDatePickerTextView"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="feom"
android:textSize="15sp" />
<EditText
android:id="#+id/toDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:layout_marginTop="22dp"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/calculateDaysButton"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:layout_marginTop="40dp"
android:background="#drawable/button_bg"
android:text="#string/calculateButtonText"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
Hope this Solves your problem.
Can you try this code
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/fromDatePickerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="from"
android:textSize="15sp"
android:layout_above="#+id/toDate"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:id="#+id/fromDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/toDate"
android:layout_alignStart="#+id/toDate" />
<TextView
android:id="#+id/toDatePickerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="to"
android:textSize="15sp"
android:layout_alignBottom="#+id/toDate"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:id="#+id/toDate"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#+id/fromDate"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp"
android:layout_toEndOf="#+id/toDatePickerTextView"
android:layout_toRightOf="#+id/toDatePickerTextView"
android:ems="10"
android:focusableInTouchMode="false"
android:inputType="date" />
</RelativeLayout>
You made a fixed size for edittext, try removing those so that you can achieve your expectations. Also use singleline=true/maxLines=1 for edit text- this is best practice.

How to make the layout scrollable when the keyboard is active?

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"

Can't get to the bottom of the content with my scrollview

I have my xml file. It is a RelativeLayout with a ScrollView and inside the ScrollView I have LinearLayout and many more. The problem is that I can't reach the end of the view, as you can see it end with a "Sign Up" button... But my view is cut by the scroll and I can just see the middle of the button, the other middle is off screen.
So, any suggestions for how can I fix this? How can I work with the ScrollView so it wraps all of my content...
Check it:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg_signup"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignUp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:background="#xml/signup_round">
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/new_signup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="#string/signup"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
<EditText
android:id="#+id/first_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="-25dp"
android:hint="#string/first_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/last_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/last_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email_confirmation"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password_confirmation"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/sex"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/sex_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-25dp"
android:entries="#array/sex_array" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/brithday"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:orientation="horizontal">
<Button
android:id="#+id/birthdayBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#color/fbutton_color_transparent"
android:onClick="showDatePickerDialog"
android:text="#string/birthdayBtn"
android:textAllCaps="false"
android:textColor="#color/colorRB" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/dateSelectedTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="--/--/--"
android:textColor="#color/colorRB"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingBottom="5dp"
android:text="#string/terms_conditions"
android:textColor="#color/colorRB"
android:textStyle="bold" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#xml/button_round"
android:onClick=""
android:text="#string/signup"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick=""
android:src="#drawable/close_signup" />
</RelativeLayout>

Button not widening

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.

Categories

Resources