I know there are similar questions on SO in this regard. But I am totally helpless.
I have a multiline edittext, which is placed in a LinearLayout after few elements. And when entering the text, it is hidden.
The solution to this was to add property android:windowSoftInputMode="adjustResize" in the manifest file. It had not effect.
Further searching on SO, I found that I need to add a property android:fitsSystemWindows="true" in the root layout element. Yet, it doesnt work. What is the issue?
Here is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mytasks">
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TaskDetails"
android:label="@string/title_activity_task_details"
android:windowSoftInputMode="adjustResize"
>
</activity>
</application>
</manifest>
The activity layout xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:fitsSystemWindows="true"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.mytasks.TaskDetails">
<TextView
android:text="Short description of the task"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="@dimen/abc_text_size_medium_material"
android:typeface="sans"
android:layout_margin="7dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/sd"
android:hint="e.g. To meet doctor"
android:layout_margin="7dp"
/>
<TextView
android:text="Type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="7dp"
android:textStyle="bold"
android:textSize="@dimen/abc_text_size_medium_material"
android:typeface="sans"
/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/type"
android:entries="@array/type"
android:layout_margin="7dp"
/>
<TextView
android:text="Priority"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="7dp"
android:textStyle="bold"
android:textSize="@dimen/abc_text_size_medium_material"
android:typeface="sans"
/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/priority"
android:entries="@array/priority"
android:layout_margin="7dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:layout_margin="7dp"
android:textStyle="bold"
android:textSize="@dimen/abc_text_size_medium_material"
android:typeface="sans"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="7dp"
>
<EditText
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:singleLine="false"
android:id="@+id/description"
android:inputType="textMultiLine"
android:gravity="top"
android:lines="4"
android:maxLines="10"
android:scrollbars="vertical"
/>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="7dp"
>
<Button
android:id="@+id/save"
android:text="Save"
android:layout_weight="1"
android:layout_width="0dip"
android:layout_height="wrap_content" />
<Button
android:id="@+id/cancel"
android:text="Cancel"
android:layout_weight="1"
android:layout_width="0dip"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
Screenshots:


Use adjustPan so the screen can be translated.
Or put all fields of your screen into the ScrollView so the area can be reduced.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With