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

displaying images from sd card folder in gallery view(android)
Suggestion required regarding designing a layout in android
android image not maintain aspect ratio
How could I get all applications that were installed by user? [duplicate]
Microsoft Merge replication for Android and iOS
Creating Android Apps only shows mobile website in WebView
Android: Purpose of using images with different pixel density?
Where are Android system media files stored?
Getting a View's position
Weird bug with Action Bar / Action Bar Sherlock, some kind of second shadowy bar
Android update FragmentManager after it loads new data
Where is JB launcher repository and why Trebuchet's src folder in CM10 is empty?
android phone number invalid address
Android Clickable Custom View before app icon on action bar
Cannot copy big database file from “Assets”
How do you control what the BACK button does?

Categories

HOME
cygwin
ng-idle
apache-jena
rdbms
interface
requirements
bitbucket-api
tivoli
scripting
3d-reconstruction
google-admin-sdk
opengl-3
nstableheaderview
special-characters
p2p
reactive-programming
enterprise-architect
plink
eip
flatpak
cumulocity
vuejs
joptionpane
hta
scriptella
jackson-modules
apktool
rpgle
failover
vex
paragraph
mustache
navigator
apiary.io
xcode7.3
nohup
chef-solo
kill
apriori
vaadin-elements
double-click
nanoc
geotiff
skin
quicktime
payload
visual-studio-2008-sp1
docpad
mta
mapinfo
jtwig
mediametadataretriever
lazybones
xvim
cgi-bin
dronekit-android
sha512
umlgraph
gamekit
mass-assignment
rapidsvn
at-job
easyrtc
iso-prolog
psr-4
verold
cancellation
winginx
gae-quotas
model-driven-development
mongohq
node-blade
actiondispatch
font-awesome-4.0.0
twisted.web
tree-balancing
fragmenttransaction
monotouch.dialog
qtconcurrent
iboutlet
jquery-address
relative
pinch
htdocs
winmain
msr
uideviceorientation
instantiationexception
object-database
office-2007
rowlex
eclipse-marketplace
sifr
qtabbar
fdf
netbeans6.1

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App