Reputation: 2357
I have an issue like after my keyboard pops up and hides there is an empty space where ever the keyboard was. I have nothing but few components inside ScrollView
.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_state" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/district"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_district" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/police_station"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_station" />
</android.support.design.widget.TextInputLayout>
<include
android:id="@+id/vehicle_type"
layout="@layout/template_cascading_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
<include
android:id="@+id/vehicle_manufacturer"
layout="@layout/template_cascading_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
<include
android:id="@+id/vehicle_model"
layout="@layout/template_cascading_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
<include
android:id="@+id/registration_no"
layout="@layout/template_registration_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/engine_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_station" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/chassis_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_station" />
</android.support.design.widget.TextInputLayout>
<include
android:id="@+id/capture_image"
layout="@layout/template_image_control"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp" />
</LinearLayout>
</ScrollView>
And ScreenShot of it.
I didn't find any reason yet why this is happening. Any Help will be helpful.
NOTE :
I Googled enough to find the solutions, adding the windowBackground
in styles.xml
didn't help. And I don't find valid reason to use that.
I also tried without adding TextInputLayout
. But the result was same.
Happening in all versions of Android.
Upvotes: 3
Views: 1046
Reputation: 2357
I managed to figure it out after breaking my head. This was happening due to android.support.design.widget.CoordinatorLayout
which I used in activity.
The above xml
is a fragment attached to the MainActivity
. In Main Activity XML I have CoordinateLayout
as parent. I think there might be some bug with using CoordinateLayout
along with ScrollView
.
Changing it to LinearLayout
fixed my issue for now.
Upvotes: 2