I'm trying to "shrink" the layout when I open the keyboard, but I'm not getting it, it's inside a ScrollView
and I noticed that it ignores the free space below the views (but there are no views) which is above them (here showing the layout with the keyboard open: link , there is one more edittext down there that does not appear, see this in xml), can I ignore it when opening the keyboard? I have already seen some topics here on the site (this need to squeeze my layout when you open the keyboard gave the idea of ScrollView
), but none worked, I tried to use android:windowSoftInputMode="adjustResize"
as the response of that topic #
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ToBuy.ToBuy" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" />
<application android:allowBackup="true" android:label="@string/app_name" android:theme="@style/AppTheme" android:icon="@drawable/ic_launcher">
<activity android:name=".EditItemActivity" android:windowSoftInputMode="adjustResize"/>
</application>
</manifest>
Layout
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
style="@style/ToolbarStyle"
android:id="@+id/toolbar"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<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:gravity="center">
<TextView
android:layout_marginTop="100dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Informações do Item:" />
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:hint="Nome"
android:inputType="textCapSentences"
android:id="@+id/eTNome" >
<requestFocus />
</EditText>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:hint="Preço"
android:inputType="number"
android:id="@+id/eTPreco" />
<SeekBar
android:id="@+id/sBImport"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_gravity="center"
android:max="99"
android:progress="33" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView
android:id="@+id/tVImport"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:gravity="center"
android:text="1. Baixa importância" />
<ImageButton
android:id="@+id/btnHelp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="5dp"
android:background="#ffffff"
android:src="@drawable/ic_help" />
</LinearLayout>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="top|left"
android:layout_marginTop="15dp"
android:hint="Anotações extras (opcional)"
android:minLines="4"
android:background="@drawable/edittext"
android:inputType="textMultiLine|textCapSentences"
android:id="@+id/eTNotas" />
</LinearLayout>
</ScrollView>
</LinearLayout>