android


Layout Resize when keyboard appear (ScrollView)


I want to maintain the screen size in Layout when the keyboard appears, my idea is obtain the next in both cases (with or without keyboard):
|-----------------|
| image |
| |
|-----------------|
| |
| center lay |
| |
|-----------------|
| |
| image |
|-----------------|
But in the center layout I have some EditText and when the soft KeyBoard appear, the center layout reduce its height and is shorter, causing the first EditText sticking to the picture above. I tried several forms, for example with a RelativeLayout align the images at the top and bottom, but when the keyboard appears hide the center layout and causes a horrible effect.
This is my code by now,
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/login_iv_points_top"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_gravity="top"
android:src="#drawable/image" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical" >
<EditText
android:id="#+id/login_et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/login_edit_margin_left"
android:layout_marginRight="#dimen/login_edit_margin_right"
android:ems="10"
android:hint="#string/login_et_email"
android:inputType="textEmailAddress" />
<EditText
android:id="#+id/login_et_pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/login_edit_margin_left"
android:layout_marginRight="#dimen/login_edit_margin_right"
android:layout_marginTop="#dimen/login_edit_pass_margin_top"
android:ems="10"
android:hint="#string/login_et_pass"
android:inputType="textPassword" />
<Button
android:id="#+id/login_bt_login"
android:layout_width="match_parent"
android:layout_height="#dimen/login_button_height"
android:layout_marginLeft="#dimen/login_button_margin_left"
android:layout_marginRight="#dimen/login_button_margin_right"
android:layout_marginTop="#dimen/login_button_margin_top"
android:background="#drawable/bt_selectable_degraded_style"
android:text="#string/login_bt_access"
android:textColor="#color/bt_text_color" />
<TextView
android:id="#+id/login_tv_forgot_pass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/login_forgot_margin_top"
android:linksClickable="true"
android:onClick="registerForgotClick"
android:text="#string/login_tv_forgot_pass"
android:textColorLink="#color/company_color" />
</LinearLayout>
<ImageView
android:id="#+id/login_iv_points_bottom"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="bottom"
android:src="#drawable/image" />
</LinearLayout>
</ScrollView>
Maybe you can try to put android:windowSoftInputMode="adjustNothing" on the activity node of your Android Manifest. The keyboard will then pop over the content.
Try to use this in activity inside manifest file:
android:configChanges="keyboardHidden|orientation"
android:windowSoftInputMode="adjustPan"
If you will remove windowSoftInputMode from manifest you will loss your scrolling so if you have a static image i mean from drawable resource than try this getWindow().setBackgroundDrawableResource(R.drawable.ic_launcher);

Related Links

AlarmManager does not start the service
Change Background of Items on Long Press
android data binding <include> layout OnClick listener dosn't work
Android ListView singleChoice - selector stays when choices are cleared
save state of togglebutton android
Android Card Layout: Draw a line spanning multiple cards
Cannot resolve method 'getWindow()'
Using a redirect url for facebook oauth on a native application
Android Studio not able to exclude sub dependecy
Android Studio activity has stopped when I use this code
How to use MucEnterConfiguration in android smack 4.2.0-beta1?
Qt for Android and BoringSSL
Center users location on Google maps but allow free movement
Not opening installed applications
java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapSerializationEnvelope with SDK 19 in android studio
Want to display string array with image addresses in grid view android

Categories

HOME
uml
algorithm
notepad++
go
azure-stream-analytics
polymer
apache-jena
phpmyadmin
formal-languages
mysql-workbench
sh
scripting
mips
telegram-bot
pyqt4
android-json
frontend
gson
resultset
cmdb
scrolltop
selectize.js
linear-algebra
template-engine
video-editing
delphi-xe5
solrcloud
breadth-first-search
blade
dataflow-diagram
scriptella
xunit
custom-post-type
mat
8051
google-earth
dotspatial
hard-drive
joomla2.5
pdw-file-browser
baidu-map
processwire
xajax
protege4
playframework-2.1
google-earth-engine
ideascript
connection-pool
apache-stanbol
portforwarding
claims
placeholder
stylecop
httrack
textsum
dotnet-httpclient
podscms
zenhub
oozie-coordinator
monkey
cd-burning
mapxtreme
omxplayer
seek
greatest-n-per-group
deep
spreadjs
inf
assertion
themoviedb-api
computer-architecture
wiredep
xvim
doctype
uncompress
ocra
rdflib
entity-framework-4.3
diff3
exceldatareader
angular-carousel
tinyxml
drupal-nodes
syndicationfeed
bin
eclipse-kepler
ice-cube
ebay-lms
poker
insert-id
swfobject
asplinkbutton
redis-py
fusefabric
stress
xcelsius
http-daemon
timertask
opml
glui
lobo-cobra
int64
contentpresenter

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App