somethings strange happen when some (not all) users tap on EditText.
Keyboard not appear.
The layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:foo="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimaryDark"
android:focusableInTouchMode="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/estra" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background_color" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#color/trasparent"
android:gravity="center"
android:navigationIcon="#drawable/back_normal"
android:textAlignment="center"
foo:layout_collapseMode="pin">
<it.estraspa.areaclienti.utilities.ui.TextViewEstra
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:text="#string/accedi"
android:textColor="#color/white"
android:textSize="18sp"
foo:Overpass="bold" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="#+id/ll_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_below="#id/toolbar"
android:layout_centerVertical="true"
android:layout_marginTop="20dp"
android:orientation="vertical">
<it.estraspa.areaclienti.utilities.ui.TextViewEstra
android:id="#+id/tv_login_error"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginBottom="#dimen/small_margin"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="50dp"
android:background="#drawable/custom_error_shape"
android:drawableLeft="#drawable/icon_error_msg"
android:drawablePadding="#dimen/normal_margin"
android:paddingStart="#dimen/normal_margin"
android:paddingTop="5dp"
android:text=""
android:textColor="#color/white"
android:textSize="#dimen/text_25px_sp13"
android:visibility="invisible"
foo:Overpass="light" />
<android.support.design.widget.TextInputLayout
android:id="#+id/til_codice_cliente"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/small_margin"
android:textColorHint="#color/white">
<it.estraspa.areaclienti.utilities.ui.EditTextEstra
android:id="#+id/et_codice_cliente"
style="#style/SingleLineText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="25dp"
android:backgroundTint="#color/white"
android:hint="#string/nome_utente"
android:inputType="text"
android:minHeight="50dp"
android:textColor="#color/white"
android:textColorHighlight="#color/white"
android:textColorHint="#color/white"
android:textSize="#dimen/text_size_37px_18dp"
foo:Overpass2="regular" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_codice_fiscale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#color/white"
foo:passwordToggleEnabled="true"
foo:passwordToggleTint="#color/white">
<it.estraspa.areaclienti.utilities.ui.EditTextEstra
android:id="#+id/et_codice_fiscale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="#dimen/small_margin"
android:backgroundTint="#color/white"
android:hint="#string/password"
android:inputType="textPassword"
android:maxLines="1"
android:minHeight="50dp"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="#dimen/text_size_37px_18dp"
foo:Overpass2="regular"
/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/ll_text"
android:layout_marginTop="20dp"
android:orientation="vertical">
<it.estraspa.areaclienti.utilities.ui.ButtonEstra
android:id="#+id/bt_accedi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/bt_registrati"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:background="#drawable/custom_button_on_blu_background"
android:clickable="true"
android:minHeight="50dip"
android:minWidth="285dp"
android:text="#string/accedi"
android:textColor="#color/colorPrimaryDark"
android:textSize="#dimen/size_16sp_31_px"
foo:Overpass3="bold" />
<it.estraspa.areaclienti.utilities.ui.TextViewEstra
android:id="#+id/tvForgotPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:clickable="true"
android:elevation="16dp"
android:gravity="center"
android:text="#string/password_dimenticata"
android:textColor="#color/white"
android:textSize="#dimen/text_14sp_27px"
foo:Overpass="bold" />
<ImageView
android:id="#+id/tvnoaccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/ll_text2"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp"
android:src="#drawable/text_no_account"
android:visibility="gone" />
<it.estraspa.areaclienti.utilities.ui.ButtonEstra
android:id="#+id/bt_registrati"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tvnoaccount"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:background="#drawable/custom_button_transparent"
android:clickable="true"
android:minHeight="50dip"
android:minWidth="285dp"
android:text="#string/registrati"
android:textColor="#color/white"
android:textSize="#dimen/size_16sp_31_px"
android:visibility="gone"
foo:Overpass3="bold" />
</LinearLayout>
</RelativeLayout>
My Manifest
<activity
android:name=".presentationlayer.activities.LoginActivity"
android:screenOrientation="portrait"
android:theme="#style/EstraStyle"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
/>
If I remove this line from manifest
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
Keyboard will work fine on all devices?
I can not reproduce the situation because I not have the specific devices.
Remove stateAlwaysHidden. It tells the OS not to show the keyboard in this activity unless shown explicitly.
Related
I have this layout of fragment:
<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"
tools:context="fragments.FrgLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="10dp">
<ImageView
android:id="#+id/logoFragmentLogin"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_margin="20dp"
android:src="#drawable/logo_erp24h"
android:transitionName="logoTransition" />
<LinearLayout
android:id="#+id/loginLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:gravity="center"
android:text="#string/bemVindo"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:gravity="center"
android:text="#string/instrucaoLogin"
android:textColor="#color/gray"
android:textSize="15sp"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/linearLayoutTwo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="50dp"
android:paddingRight="50dp"
android:paddingTop="20dp">
<EditText
android:id="#+id/usernameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:hint="#string/usuario"
android:textIsSelectable="true"
android:textColor="#color/gray"
android:textColorHint="#color/light_gray"
android:theme="#style/loginFields" />
<android.support.design.widget.TextInputLayout
android:id="#+id/etPasswordLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintEnabled="false"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/gray">
<android.support.design.widget.TextInputEditText
android:id="#+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:hint="#string/senha"
android:inputType="textPassword"
android:textColor="#color/gray"
android:textColorHint="#color/light_gray"
android:theme="#style/loginFields" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/loginEnterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/blue_background"
android:clickable="true"
android:padding="6dp">
<ImageView
android:id="#+id/loginEnterImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_right_arrow" />
<ProgressBar
android:id="#+id/loginEnterProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="#color/white"
android:visibility="invisible" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="#font/proxima_nova"
android:text="#string/entrar"
android:textColor="#color/primary"
android:textSize="20sp"
android:textStyle="bold|italic" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
When a digit a text in username and password fields, the cursor accompanies the text, but nothing appear. This fragment is load inside a Acitivty on a Frame Layout. This bug happens only on Android Lollipop device, on emulator and real smartphone;
I can select text and copy, cut, paste, but continues invisible
Please help me !!
Methods used on Fragment class with setVisibility not working
I'm trying to test my app on Mobiwire MobiPrint with Android version 4.2.2
I put this statement in the Activity tag in the manifest file to resize the screen when the soft keyboard is visible
android:windowSoftInputMode="adjustResize|stateVisible|stateAlwaysHidden"
this is my XML file
<?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="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:focusable="true"
android:focusableInTouchMode="true"
android:fitsSystemWindows="true"
android:gravity="center_vertical|center"
android:layoutDirection="rtl"
android:orientation="vertical"
tools:context="com.egpay.merchant.activities.LoginActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal|center"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="30dp"
android:paddingRight="30dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="25dp"
app:srcCompat="#drawable/egpay_logo" />
<android.support.design.widget.TextInputLayout
android:id="#+id/id_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/EditTextHint">
<EditText
android:id="#+id/input_id"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="end"
android:layout_marginBottom="10dp"
android:drawableEnd="#drawable/ic_user"
android:drawablePadding="8dp"
android:hint="#string/merchantCode"
android:inputType="number"
android:textAlignment="viewEnd"
tools:ignore="RtlCompat" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/password_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/EditTextHint">
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="end"
android:drawableEnd="#drawable/ic_password"
android:drawablePadding="8dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textAlignment="viewEnd"
tools:ignore="RtlCompat" />
</android.support.design.widget.TextInputLayout>
<CheckBox
android:id="#+id/chk_save_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:buttonTint="#color/colorPrimary"
android:checked="false"
android:gravity="left|center"
android:layoutDirection="rtl"
android:text="#string/savePassword"
android:textColor="#android:color/darker_gray"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dip"
android:orientation="horizontal"
android:weightSum="10">
<TextView
android:id="#+id/btn_forget"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_weight="6"
android:gravity="center_vertical"
android:text="#string/forgetPassword"
android:textAlignment="center"
android:textColor="#android:color/darker_gray"
android:textSize="16sp" />
<Button
android:id="#+id/btn_login"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:layout_weight="4"
android:background="#drawable/bg_colorful_btn_main"
android:text="#string/login"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="20sp" />
</LinearLayout>
<!-- Link to Login Screen -->
<Button
android:id="#+id/btn_update"
android:layout_width="300dp"
android:layout_height="50dp"
android:text="Update Now" />
</LinearLayout>
</RelativeLayout>
and here's screenshot of the result:
as you can see when the keyboard is visible the screen resize itself but the keyboard still covering some parts.
what can I do to solve this issue???
note that I tested the app on another device running Android version 5.1.1 and it's working fine
Hi can you try like this
android:windowSoftInputMode="adjustPan|adjustResize"
instead of
android:windowSoftInputMode="adjustResize|stateVisible|stateAlwaysHidden"
I prepare my app for Android O support and want to make auto-fill work correctly. I selected Google Auto-fill service in System Settings, added special hints for auto-fill.
I have Sign-in dialog extends DialogFragment.
As wrote in Android developer, I don't need any movements to make auto-fill work, it will work automatically excepts addition to layout "android:autofillHints" and "android:importantForAutofill".
But autofill doesn't work.
Dialog layout:
<?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">
<LinearLayout
android:id="#+id/layout_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="yes"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingLeft="21dp"
android:paddingRight="21dp"
android:paddingTop="20dp">
<TextView
style="#style/LoginDialogTextTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/button.text.enter" />
<com.myapp.android.views.widgets.TextInputLayout
android:id="#+id/layout_text_email"
android:layout_width="match_parent"
android:layout_height="59dp"
android:layout_marginTop="14dp"
android:hint="#string/label.email"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/text_email"
style="#style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="emailAddress"
android:inputType="textEmailAddress"
app:backgroundTint="#color/_gray_text"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout" />
</com.myapp.android.views.widgets.TextInputLayout>
<RelativeLayout
style="#style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.myapp.android.views.widgets.TextInputLayout
android:id="#+id/layout_text_password"
android:layout_width="match_parent"
android:layout_height="59dp"
android:hint="#string/hint.password"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout"
app:passwordToggleEnabled="false">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/text_password"
style="#style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:autofillHints="password"
android:inputType="textPassword"
android:paddingRight="100dp"
app:backgroundTint="#color/_gray_text"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout"
/>
</com.myapp.android.views.widgets.TextInputLayout>
<TextView
android:id="#+id/button_show_password"
style="#style/TextLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="4dp"
android:layout_marginTop="20dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:text="#string/show" />
</RelativeLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/button_enter"
style="#style/ButtonBig"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="#string/button.text.enter" />
<TextView
android:id="#+id/button_restore"
style="#style/TextLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="13dp"
android:text="#string/button.text.forget_password" />
<TextView
android:id="#+id/button_cancel"
style="#style/ButtonDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="17dp"
android:clickable="true"
android:text="#string/cancel" />
</LinearLayout>
<ProgressBar
android:id="#+id/progress_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:visibility="gone"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</RelativeLayout>
I have a Coordinator layout in activity xml and an include layout that have a content layout xml. Like this:
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
android:id="#+id/main">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="#layout/content_sign_in" />
</android.support.v4.widget.NestedScrollView>
When i put my content layout inside a nestedscrollview my content layout double your heigth. Anyone can help me?
My Content layout xml:
<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:id="#+id/content_sign_in"
android:layout_width="match_parent"
android:background="#drawable/sign_up_bg"
android:layout_height="match_parent"
tools:showIn="#layout/activity_sign_in">
<ImageButton
android:id="#+id/arrow_back"
android:layout_marginTop="15dp"
android:layout_marginLeft="10dp"
android:scaleType="centerInside"
android:padding="5dp"
android:src="#drawable/ic_back_white"
android:background="#android:color/transparent"
android:layout_width="40dp"
android:layout_height="40dp" />
<ImageView
android:scaleType="centerInside"
android:layout_below="#+id/arrow_back"
android:id="#+id/logo"
android:layout_marginTop="6dp"
android:layout_centerHorizontal="true"
android:layout_width="78dp"
android:layout_height="45dp" />
<android.support.design.widget.TextInputLayout
android:textColorHint="#color/color_80ffffff"
android:id="#+id/input_layout_email"
android:layout_marginLeft="46dp"
android:hint=" "
android:layout_marginRight="46dp"
android:layout_marginTop="74dp"
android:layout_below="#+id/logo"
app:errorTextAppearance="#style/error_appearance"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/work_email"
android:gravity="center"
android:theme="#style/EditTextLogin"
android:textColorHint="#color/color_80ffffff"
android:hint="#string/hint_work_email"
android:textColor="#android:color/white"
android:textSize="14sp"
android:inputType="textEmailAddress"
android:imeOptions="actionNext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:textColorHint="#color/color_80ffffff"
android:id="#+id/input_layout_password"
android:layout_marginLeft="46dp"
android:hint=" "
android:theme="#style/EditTextLogin"
android:layout_marginRight="46dp"
android:layout_below="#+id/input_layout_email"
app:errorTextAppearance="#style/error_appearance"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/password"
android:gravity="center"
android:textColorHint="#color/color_80ffffff"
android:hint="#string/hint_password"
android:textColor="#android:color/white"
android:textSize="14sp"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<Button
android:layout_below="#+id/input_layout_password"
android:id="#+id/btn_sign_in"
android:textColor="#android:color/white"
android:text="#string/btn_login"
android:layout_marginTop="26dp"
android:background="#color/colorAccent"
android:layout_marginRight="60dp"
android:layout_marginLeft="60dp"
android:layout_width="match_parent"
android:layout_height="40dp" />
<RelativeLayout
android:layout_marginTop="17dp"
android:layout_below="#+id/btn_sign_in"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/label_sign_up"
android:textSize="14sp"
android:text="#string/lbl_sign_up"
android:textColor="#color/color_80ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_toRightOf="#+id/label_sign_up"
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:id="#+id/btn_sign_up"
android:textSize="14sp"
android:text="#string/txt_sign_up"
android:textColor="#android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<TextView
android:id="#+id/forgot_password"
android:textColor="#color/color_80ffffff"
android:textSize="14sp"
android:gravity="center"
android:text="#string/text_forgot_password"
android:layout_marginBottom="20dp"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:visibility="gone"
android:id="#+id/layout_resend"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="86dp">
<ImageView
android:scaleType="fitXY"
android:src="#drawable/pink_bar"
android:layout_width="match_parent"
android:layout_height="86dp" />
<Button
android:id="#+id/btn_resend"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true"
android:layout_marginTop="26dp"
android:textSize="14sp"
android:text="#string/txt_resend"
android:textColor="#color/color_505065"
android:background="#android:color/transparent"
android:layout_width="wrap_content"
android:layout_height="40dp" />
<ImageView
android:id="#+id/ic_email"
android:layout_marginLeft="16dp"
android:layout_marginTop="26dp"
android:src="#drawable/ic_email_confirmation_white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/ic_email"
android:layout_toLeftOf="#+id/btn_resend"
android:layout_marginTop="26dp"
android:textSize="14sp"
android:text="#string/text_resend_email"
android:textColor="#android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<RelativeLayout
android:visibility="gone"
android:id="#+id/load"
android:background="#aa000000"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="50dp"
android:layout_height="50dp" />
</RelativeLayout>
i don't know why this happen
I don't see anything wrong with your layout hierarchy. Things might be a little weird because you are using an image as a background, and no fixed height and width. I don't know if this is a XML background or a image file, but if it is the latter, I'd recommend using an image view inside the relative layout with a fixed size and a scale type defined.
XML:
<?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">
<include layout="#layout/toolbar"/>
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:layout_above="#+id/makeOffer"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/firstcard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/insidecardone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/constant_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/padding_4dp"
android:text="Charge per day"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/tvRentPerday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:hint="Rs. "
android:gravity="center"
android:inputType="number"
android:maxLength="4"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/insidecardtwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Duration (Days)"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/num_days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_24dp"
android:text="10"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_8dp"
android:background="#color/grey_lighter" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:paddingBottom="#dimen/padding_8dp"
android:paddingTop="#dimen/padding_24dp">
<TextView
android:id="#+id/total_constant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Total Amount"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/tvAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:textColor="#ff4f00"
android:textSize="#dimen/text_size_big_16"
android:textStyle="bold" />
<TextView
android:id="#+id/total_constant_mutterfly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/total_constant"
android:paddingTop="#dimen/padding_4dp"
android:text="#string/process_fee_text"
android:textColor="#android:color/darker_gray"
android:textSize="8sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/middlecard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/firstcard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/middlecard_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/deposite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Deposit"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/knowmore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/deposite"
android:text="#string/txt_know_more"
android:layout_marginTop="#dimen/padding_8dp"
android:textSize="#dimen/text_size_extra_extra_small_10"
/>
<CheckBox
android:id="#+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:inputType="number"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/middletwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard_relative"
android:layout_margin="#dimen/padding_4dp"
android:visibility="gone"
>
<TextView
android:id="#+id/middle_con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Charge (Rs.)"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/etDeposit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:hint="1000"
android:maxLength="4"
android:inputType="number"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/seccard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/describe_constant_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
android:text="Describe Your item"
android:textColor="#ff4f00"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/rlTohide"
android:layout_marginTop="#dimen/padding_4dp"
android:layout_width="160dp"
android:layout_height="120dp"
android:background="#drawable/greyborder_transparentbg"
>
<ImageView
android:id="#+id/img1"
android:layout_centerInParent="true"
android:layout_width="40dp"
android:src="#drawable/addimg"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/img1"
android:text="(Optional)"
android:textSize="#dimen/text_size_extra_extra_small_10"
android:textColor="#color/text_grey_opc"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<ImageView
android:visibility="gone"
android:id="#+id/imgResource"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="180dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/con_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="8dp"
android:text="Name Of Product"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/con_product_name"
android:layout_toRightOf="#+id/con_product_name"
android:layout_alignParentRight="true"
android:hint="E.g. Nikon DSLR"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:maxLength="30"
android:inputType="textPersonName"
android:layout_marginLeft="#dimen/padding_16dp"
android:layout_marginStart="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Description :"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/desc_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Description"
android:hint="E.g. Comes with 18-55 mm lens, charger and carry case"
android:layout_marginTop="#dimen/padding_8dp"
android:background="#drawable/white_border_request_screen"
android:textColor="#android:color/darker_gray"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/makeOffer"
android:layout_width="match_parent"
android:layout_height="#dimen/padding_48dp"
android:layout_alignParentBottom="true"
android:background="#color/new_primary_text"
android:padding="#dimen/padding_8dp"
android:text="#string/txt_make_offr"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_18"
/>
</RelativeLayout>
Android Manifest
<activity
android:name=".MyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
I am working on the layout since last night and I tried almost solution which I known. I am new in Android so please suggest me what is wrong with this layout.
this "fillViewport" work for another screen but with this screen it's not working.
Add android:windowSoftInputMode="stateHidden|adjustResize" to your <activity> tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.
One more thing set property of ScrollView to the android:layout_above to the Button on the bottom of the page.
UpDate :
add this line to your ScrollView.
android:layout_above="#+id/makeOffer"
like this way
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_above="#+id/makeOffer">
ScreenShot :