android:windowSoftInputMode="adjustResize is not working properly on MobiWire - android

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"

Related

Text typed not showing on Lollipop in Fragment layout

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

After Tap on EditText Android not show Keyboard only on some devices

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.

How to avoid the frame layout is pushed up when the soft keyboard appears?

I am facing the issue ,when the soft keyboard is appeared the frame layout in top of the activity is pushed up .The Frame Layout is placed inside the Linear Layout and below the scrollview is placed inside the scrollview multiple edittext are placed . I have tried the answers posted in the stack overflow but still my problem is not solved.
I am buliding the app in target sdk version 25 and mimimum version 16.
I applied `below method to the activity in AndroidManifestFile.
<activity android:name=".Activities.ScamLookUpActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|screenLayout|"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>`
I don't know how to solve this error and tell the reason the why the given method is not appllied to my activity.
This is my xml layout file...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_scam_look_up"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#eee"
tools:context="com.zcodia.scamlookup.Activities.ScamLookUpActivity">
<FrameLayout
android:id="#+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<View
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_height="?android:attr/actionBarSize"
android:background="#mipmap/bg_splash_cut">
</View>
<View
android:layout_width="match_parent"
android:layout_height="25dp"
android:alpha="1"
android:background="#A82A37" />
<TextView
android:id="#+id/left_buton"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="30dp"
android:text="#string/menu"
android:textSize="30dp"
android:gravity="center"
android:textColor="#FFF"/>
<com.zcodia.scamlookup.Utils.CustomTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Scam lookup"
android:layout_marginTop="29dp"
android:layout_marginLeft="60dp"
android:textSize="20dp"
android:textColor="#FFF"
android:gravity="center"/>
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#f9f9f9"
android:focusableInTouchMode="true"
android:paddingBottom="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#drawable/text_input2"
>
<com.zcodia.scamlookup.Utils.CustomTextView
android:text="Search Scam Database"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:id="#+id/textView4"
android:textSize="20dp"
android:textColor="#000"
android:layout_below="#+id/linearLayout"
android:typeface="sans"
/>
<com.zcodia.scamlookup.Utils.CustomTextView
android:text="Contact Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView4"
android:layout_marginLeft="10dp"
android:id="#+id/details_id"
android:textColor="#D32F2F"
android:typeface="sans"
android:textSize="15dp"
android:layout_marginTop="10dp"/>
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="#+id/recyclerView"
></android.support.v7.widget.RecyclerView>
</LinearLayout>
<com.zcodia.scamlookup.Utils.CustomTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Category"
android:id="#+id/textView5"
android:layout_below="#+id/linearLayout2"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
android:textColor="#D32F2F"
android:textSize="15dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical"
android:paddingBottom="20dp"
android:id="#+id/relative_spinner"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textinput"
android:layout_marginRight="10dp">
<Spinner
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:id="#+id/categorySpinner"
android:text="#string/inheritance"
android:prompt="#string/inheritance"
android:paddingLeft="0dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textinput"
android:layout_marginRight="10dp">
<Spinner
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="1dp"
android:id="#+id/categorySpinner2"
android:text="#string/inheritance"
android:prompt="#string/inheritance"
android:paddingLeft="0dp"
/>
</RelativeLayout>
<com.zcodia.scamlookup.Utils.CustomEditText
android:inputType="phone"
android:id="#+id/phoneNumber_editText"
android:hint="#string/phonenumber"
android:typeface="sans"
style="#style/CustomFontStyle"
android:layout_marginTop="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:id="#+id/yourLocation"
android:hint="Location"
android:textColorHint="#757575"
style="#style/CustomFontStyle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:text=""
android:id="#+id/scammer_location_font"
android:textColor="#3eb3a0"
android:textSize="25dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>
<com.zcodia.scamlookup.Utils.CustomEditText
android:inputType="textPersonName"
android:hint="#string/scammer_location"
android:id="#+id/scammerLocation_editText"
android:typeface="sans"
style="#style/CustomFontStyle"
android:layout_marginTop="20dp"
/>
<com.zcodia.scamlookup.Utils.CustomEditText
android:inputType="textPersonName"
android:hint="#string/keyWord"
android:id="#+id/keyword_edittext"
android:background="#drawable/textinput"
android:typeface="sans"
style="#style/CustomFontStyle"
android:layout_marginTop="20dp"
/>
</LinearLayout>
<com.wefika.flowlayout.FlowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/clip_flow_layout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
</com.wefika.flowlayout.FlowLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<com.zcodia.scamlookup.Utils.CustomButton
android:text="Search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/search_id"
android:background="#mipmap/bg_splash_cut"
android:textColor="#FFFFFF"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
</LinearLayout>
</ScrollView>
The below image is my activity.
when the edittext is pressed the top frame layout is pushed up.
I think you should try "statehidden" and "adjustPan" together.
<activity android:windowSoftInputMode="adjustPan|stateHidden">
Try this answer,
<activity android:windowSoftInputMode="adjustPan"> </activity>
apply this attribute to your Scroll view:android:fitsSystemWindows="true" and Follow this
link

Move Layout Up when Soft Keyboard appears

I have login page with Email Id ,Password & LOGIN button. Right now when any one of the Edit Text gain focus then system keyboard hides my Login button. I want to push my layout above when keyboard appears keeping LOGIN button above of keyboard.
P.S I've tried all solution like
adjust Pan|adjust Resize, adjust Pan,adjust Resize"
in manifest as well as in Java code
But none of thing worked for me.
<ScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/newl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="145dp"
android:drawablePadding="8dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/ic_clock"
android:id="#+id/clock"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Timetracker"
android:fontFamily="LucidaGrande"
android:textSize="30dp"
android:textAlignment="center"
android:layout_marginTop="15dp"
android:layout_gravity="center_horizontal"
android:id="#+id/tt"
android:layout_below="#+id/clock"
android:textColor="#FFFFFF"
android:layout_centerHorizontal="true"
/>
<LinearLayout
android:layout_below="#+id/tt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp"
>
<ImageView
android:layout_marginLeft="7dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_person_black_24dp"
android:layout_centerVertical="true"
/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#FFFFFF"
android:layout_marginLeft="9dp"
android:drawablePadding="12dp"
android:textSize="15dp"
android:layout_marginRight="45dp"
android:fontFamily="Sans Serif"
android:layout_centerInParent="true"
android:textColor="#FFFFFF"
android:background="#android:color/transparent"
android:id="#+id/spinner2"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_arrow_drop_down_black_24dp"
android:layout_alignParentRight="true"
android:paddingRight="8dp"
android:layout_centerVertical="true"/>
</RelativeLayout>
<View
android:layout_below="#+id/rel"
android:layout_width="match_parent"
android:background="#FFF"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_height="1dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/lock"
android:drawablePadding="12dp"
android:layout_marginTop="30dp"
android:layout_below="#+id/rel"
android:layout_marginRight="7dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="7dp"
android:hint="Password"
android:background="#android:color/transparent"
android:textColorHint="#FFFFFF"
android:textSize="20dp"
android:textColor="#FFFFFF"
android:id="#+id/editText"
android:inputType="textPassword"
android:backgroundTint="#FFFFFF"
/>
<View
android:layout_below="#+id/editText"
android:layout_width="match_parent"
android:background="#FFF"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_height="1dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_below="#+id/editText"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:background="#FFFFFF"
android:text="LOG IN"
android:id="#+id/log"
android:textColor="#D04045"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
The solution was to use android:fillViewport="true" on the ScrollView.
and with this you can also use android:windowSoftInputMode="adjustResize"
this worked for me
try this,
Add the below line in your manifest file,
android:windowSoftInputMode="adjustResize"
For example,
<activity android:name=".Game" android:windowSoftInputMode="adjustResize">
</activity>

background is scrolling it should be constant?

I have designed the login layout as follows
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/login_bg">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:id="#+id/login_fields_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">
<ImageView
android:id="#+id/loginLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="30dp"
android:src="#drawable/logo" />
<EditText
android:id="#+id/userNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:background="#drawable/textfield"
android:drawableLeft="#drawable/username"
android:drawablePadding="10dip"
android:hint="#string/hint_username"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:maxLength="50"
android:padding="10dp"
android:singleLine="true"
android:textColor="#color/login_textcolor"
android:textCursorDrawable="#null" />
<EditText
android:id="#+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textfield"
android:drawableLeft="#drawable/password"
android:drawablePadding="10dip"
android:hint="#string/hint_password"
android:imeOptions="actionNext"
android:inputType="textPassword"
android:padding="10dp"
android:singleLine="true"
android:textColor="#color/login_textcolor"
android:textCursorDrawable="#null" />
<LinearLayout
android:id="#+id/loginOptionsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="2">
<CheckBox
android:id="#+id/rememberMeCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:checked="false"
android:drawableEnd="#drawable/bg_checkbox"
android:gravity="center_vertical"
android:paddingRight="40dp"
android:text="#string/text_rememberme"
android:textColor="#color/login_textcolor"
android:textSize="14sp" />
<Button
android:id="#+id/forgotPasswordButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#null"
android:gravity="right|center_vertical"
android:singleLine="true"
android:text="#string/text_forgotpassword"
android:textColor="#color/login_textcolor"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#drawable/button_bg"
android:text="#string/text_login"
android:textColor="#android:color/white"
android:textSize="20dp"
android:textStyle="bold" />`
</LinearLayout>
</ScrollView>
</RelativeLayout>
when the i touched on the edittext the background is moving up it need to be constant as it is outside the scrollview.How to solve this issue.
i have referred the following
Background Image Placement
as in this they need in the bottom corner i need it as background.but anyway with curiosity i tried it but still it is scrolling the background
I tried it and it works. Remove the background from xml layout
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE|WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
getWindow().setBackgroundDrawableResource(R.drawable.login_bg) ;
Use the following in your activity
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Categories

Resources