I want half of my ImageView to overlay the toolbar, the other half overlay the layout, exactly like in the image below, and it should work for all resolutions. How can i achieve it?
How it should look like
My layout for now looks like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.fiekpasswordmanager.PasswordAddActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/add_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorPrimary"/>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/name_of_website_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<EditText
android:id="#+id/et_name_of_website"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/name_of_website"
android:inputType="text"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/website_address_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<EditText
android:id="#+id/et_website_address"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/website_address"
android:inputType="text"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/username_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<EditText
android:id="#+id/et_username"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/username"
android:inputType="text"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/password_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true"
app:passwordToggleEnabled="true">
<EditText
android:id="#+id/et_password"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/password"
android:inputType="textPassword"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<TextView
android:id="#+id/et_generate_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:text="#string/generate_password"/>
</LinearLayout>
I dont want a solution like adding martionTop or something like this, it should be more general, which will work in mostly/all devices.
Wrap your toolbar inside a FrameLayout and inside that same FrameLayout add the image. Position the image with gravity (center horizontal) and some margin top (in dp).
When you want to position an element over another one use FrameLayout (or CoordinatorLayout if it wraps all the content of the Fragment).
Your layout upadted with this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.fiekpasswordmanager.PasswordAddActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/add_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorPrimary"/>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/name_of_website_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
app:errorEnabled="true">
<EditText
android:id="#+id/et_name_of_website"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/name_of_website"
android:inputType="text"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/website_address_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<EditText
android:id="#+id/et_website_address"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/website_address"
android:inputType="text"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/username_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true">
<EditText
android:id="#+id/et_username"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/username"
android:inputType="text"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<com.example.fiekpasswordmanager.CustomTextInputLayout
android:id="#+id/password_textinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:errorEnabled="true"
app:passwordToggleEnabled="true">
<EditText
android:id="#+id/et_password"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/password"
android:inputType="textPassword"
android:maxLines="1"/>
</com.example.fiekpasswordmanager.CustomTextInputLayout>
<TextView
android:id="#+id/et_generate_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:text="#string/generate_password"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:gravity="center_horizontal">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"/>
</LinearLayout>
</FrameLayout>
Another way could be transforming all to constraint layout, there is more than one solution.
You can try using RelativeLayout as the root layout, and placing the ImageView below the Toolbar, then give the margin_top to "negative half your image height".
Related
I have a layout file in my Android application like below;
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/myPage"
android:theme="#style/login"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="#+id/myimageview"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:src="#drawable/mypicture"/>
<com.myapp.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/myimageview"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="#string/mystring"
android:textColor="#fff"
android:textSize="12sp"
app:rt_fontWeight="light" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/password_text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:theme="#style/loginTheme">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="#string/password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
I want to put space between the RelativeLayout that contains the RobotoTextView and the LinearLayout under this layout.They are in the same level in my layout file.Also my app has to be run on different screen resolutions.
It must be something like a constraint between the RobotoTextView and the LinearLayout under this text view.
I tried android:layout_marginTop in the LinearLayout but it did not work. RobotoTextView overlapped with the text view under the LinearLayout
Add this attribute to the bottom layout that gives it an id:
android:id="#+id/bottom"
and these to the top layout:
android:layout_marginBottom="10dp"
android:layout_alignParentTop="true"
android:layout_above="#+id/bottom"
you can change 10dp to anything you like.
Also remove
android:layout_weight="1"
since it applies only to views inside LinearLayout
you did not explain well but , i did my best according to your Instruction.
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/myPage"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/linearfirst">
<ImageView
android:id="#+id/myimageview"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp" />
<com.myapp.RobotoTextView
android:layout_width="159dp"
android:layout_height="51dp"
android:layout_below="#+id/myimageview"
android:layout_alignStart="#+id/myimageview"
android:layout_alignLeft="#+id/myimageview"
android:layout_alignEnd="#+id/myimageview"
android:layout_alignRight="#+id/myimageview"
android:layout_marginStart="-15dp"
android:layout_marginLeft="-15dp"
android:layout_marginTop="13dp"
android:layout_marginEnd="-23dp"
android:layout_marginRight="-23dp"
android:gravity="center"
android:text="#string/mystring"
android:textColor="#fff"
android:textSize="12sp"
app:rt_fontWeight="light" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/linearfirst"
android:layout_marginTop="10dp"
android:layout_alignParentBottom="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_marginBottom="2dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/password_text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
>
<android.support.v7.widget.AppCompatEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
I am using collapsing toolbar with nested ScrollView in Registration fragment, But the register button at the bottom is not fully displaying for the first time when I click on some edit text and opens keyboard if I scroll to bottom then the button is fully visible.
The image is attached below.
Before opening keyboard
when keyboard opens
After keyboard closed
Here is the xml code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
style="#style/StyledTilEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/stemiIcon"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<EditText
android:id="#+id/et_reg_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Name"
android:imeOptions="actionNext"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="#style/StyledTilEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/stemiIcon"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<EditText
android:id="#+id/et_reg_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone"
android:imeOptions="actionNext"
android:inputType="phone" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="#style/StyledTilEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/stemiIcon"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<EditText
android:id="#+id/et_reg_dob"
style="#style/StyledTilEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:cursorVisible="false"
android:editable="false"
android:hint="Date of birth"
android:imeOptions="actionNext"
android:inputType="none"
android:longClickable="false" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="#style/StyledTilEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/stemiIcon"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<EditText
android:id="#+id/et_reg_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:imeOptions="actionNext"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="#style/StyledTilEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/stemiIcon"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<EditText
android:id="#+id/et_reg_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:imeOptions="actionNext"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="15dp"
android:text="Gender"
android:textColor="#color/text_line" />
<com.agiliztech.stepout2play.customviews.AnswerTemplateView
android:id="#+id/answerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/have_diabetes"
android:layout_margin="10dp"
app:clickedColor="#color/selected_gender"
app:colorView="#color/color_white"
app:textBackground="#drawable/text_border_with_color"
app:textColor="#color/selected_gender">
</com.agiliztech.stepout2play.customviews.AnswerTemplateView>
<Button
android:id="#+id/bt_reg_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#color/btn_color"
android:text="REGISTER"
android:textColor="#color/color_white" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
Set height to match_parent and add android:fillViewport element
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:fillViewport="true"/>
...
...
</android.support.v4.widget.NestedScrollView>
Add
android:windowSoftInputTypeMode="adjustResize|stateAlwaysHidden" to activity in your manifest, then make your nestedtscrollview height match parent and fillviewport true in the xml
Try to add android:minHeight to yourCollapsingToolbarLayout
Hi All could someone direct me on how i could align the Spinners and Edit text attached in the screen
Thank you for your help
XML file - below is the layout XML file for the UI screen
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="eudhar.com.eudhar.transaction.MakeTransactionFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Make Transaction"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
style="#style/Base.V7.Widget.AppCompat.EditText"/>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.toptoche.searchablespinnerlibrary.SearchableSpinner
android:id="#+id/selectCustomer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select customer"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="#+id/selectTransactionType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select Transaction Type"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Amount in Rs."
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextTransactionDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Transaction Date"
android:inputType="none"
/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/buttonAddTrasaction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Transaction" />
</LinearLayout>
Give margin to your Linear /Relative layout, else share your code, so I can easily give you the answer.
Is this okay?
Try this below code, i have given paddingLeft and paddingRight "5dp" to the parent layout itself. You may adjust as you need.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tools:context="eudhar.com.eudhar.transaction.MakeTransactionFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Make Transaction"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
style="#style/Base.V7.Widget.AppCompat.EditText"/>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.toptoche.searchablespinnerlibrary.SearchableSpinner
android:id="#+id/selectCustomer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select customer"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="#+id/selectTransactionType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select Transaction Type"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Amount in Rs."
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextTransactionDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Transaction Date"
android:inputType="none"
/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/buttonAddTrasaction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Transaction" />
</LinearLayout>
In my LoginActiviy, I have two buttons. They have the exact same properties in the XML but only the upper button has a shadow underneath it. The image below demonstrates this
Here is the XML for the layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
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">
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"/>
<ScrollView
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:maxLines="1"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/password"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/login"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/signInButton"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/login"
android:textStyle="bold"/>
<Button
android:id="#+id/continueAsLoggedOutButton"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/continue_as_logged_out"
android:textStyle="bold"/>
</LinearLayout>
</ScrollView>
What is the cause for this?
As Mike M. commented, I added layout_marginBottom to the button and it solved the problem
Try to add a paddingBottom on the LinearLayout.
So I've been designing in XML in Android Studio a standard log in page - with an image covering about half of the screen, and then the edit text fields occupying the bottom half, asking for the log in details. My problem is that when I tap on the edit text fields on smaller mobile displays, it will only snap to and show the field I have selected, when I think it's far better if it were to automatically snap to show all fields and the 'Next' button at once.
An overview of the page
When I click on 'UserID' field
What I WANT to see when I click on 'UserID' field
How do I achieve this result?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context="com.example.android.brunelplanner.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/logo"
android:layout_width="match_parent"
android:layout_height="250sp"
android:background="#color/colorPrimary"
android:orientation="vertical"></LinearLayout>
<RelativeLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/logo"
android:orientation="vertical">
<LinearLayout
android:id="#+id/login_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.87"
android:gravity="center"
android:text="eVision Log in"
android:textColor="#000000"
android:textSize="20sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_userID"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_password"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/login_fields">
<Button
android:id="#+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="#string/action_sign_in"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Cant comment so I have to write here. If you XML in question is current, you have to align parent bottom the whole layout that you want to move up. The bottom alignment must have the whole login form not just button. Also you have linear layout on top which has fixed height, that could be a problem too.
EDIT: Ok, try this, it works on my end. BUT I simplified the XML for testing so dont copy it, just try to edit your xml.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/email_login_form"
android:layout_alignParentTop="true"
android:background="#color/colorPrimary"
android:orientation="vertical">
</LinearLayout>
<RelativeLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true">
<LinearLayout
android:id="#+id/login_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.87"
android:gravity="center"
android:text="eVision Log in"
android:textColor="#000000"
android:textSize="20sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/email_login_form"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="sign in"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>