android:fitsSystemWindows not working on Fragment












0
















Image
enter image description here



Fragment Layout




<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:background="@drawable/fragments_background"
tools:context=".ui.fragments.BillPaymentFragment">

<LinearLayout
android:id="@+id/wallet"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/wolletColor"
android:orientation="horizontal">

<ImageView
android:layout_width="@dimen/dimen_50dp"
android:layout_height="@dimen/dimen_50dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dimen_20dp"
android:background="@drawable/wallet" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="@dimen/dimen_4dp"
android:orientation="vertical">

<TextView
android:id="@+id/wallet_remains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dimen_10dp"
android:text="3450.00 LKR"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/dimen_16dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wallet_remains"
android:textColor="@color/gray"
android:textSize="@dimen/dimen_12dp" />
</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingTop="@dimen/dimen_60dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:padding="@dimen/dimen_20dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="Mobile No"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_mobile_number"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="@dimen/dimen_20dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/mobile_number"
android:inputType="phone"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="@string/amount"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_amount"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/amount_hint"
android:inputType="number"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

</LinearLayout>


</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dimen_20dp"
android:layout_marginStart="@dimen/dimen_20dp"
android:gravity="bottom"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:id="@+id/cancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginEnd="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/secondary_button"
android:text="Cancel"
android:textColor="@color/white" />

<Button
android:id="@+id/btn_proceed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginStart="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/primary_button"
android:text="Proceed"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>



AndroidManifest.xml




  <activity
android:windowSoftInputMode="adjustResize"
android:name=".ui.main.MainActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar"></activity>


I have a fragment call reload fragment that was attached above. Parent activity is MainActivity here I attached manifest file code which related to activity.When I click in the edittext bottom buttons cover edittext fields with the keyboard. Here I added android:fitsSystemWindows property in the manifest file. Is there anything missing my code?T hanks in advanced.










share|improve this question

























  • did you tried with android:windowSoftInputMode="adjustPan"

    – Mr.Bunny
    Nov 26 '18 at 5:38











  • @BunnyYes, Same Result.

    – Rajitha Perera
    Nov 26 '18 at 5:42











  • Makes sense. It is the parent Activity that has to set android:fitsSystemWindows, not the child fragment.

    – lionscribe
    Nov 26 '18 at 5:43











  • @lionscribe you mean that "android:fitsSystemWindows="true"" should put in parent activity layout ?

    – Rajitha Perera
    Nov 26 '18 at 5:46






  • 1





    @RajithaPerera add scroll view in your XML.

    – nimi0112
    Nov 26 '18 at 6:18


















0
















Image
enter image description here



Fragment Layout




<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:background="@drawable/fragments_background"
tools:context=".ui.fragments.BillPaymentFragment">

<LinearLayout
android:id="@+id/wallet"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/wolletColor"
android:orientation="horizontal">

<ImageView
android:layout_width="@dimen/dimen_50dp"
android:layout_height="@dimen/dimen_50dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dimen_20dp"
android:background="@drawable/wallet" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="@dimen/dimen_4dp"
android:orientation="vertical">

<TextView
android:id="@+id/wallet_remains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dimen_10dp"
android:text="3450.00 LKR"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/dimen_16dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wallet_remains"
android:textColor="@color/gray"
android:textSize="@dimen/dimen_12dp" />
</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingTop="@dimen/dimen_60dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:padding="@dimen/dimen_20dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="Mobile No"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_mobile_number"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="@dimen/dimen_20dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/mobile_number"
android:inputType="phone"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="@string/amount"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_amount"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/amount_hint"
android:inputType="number"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

</LinearLayout>


</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dimen_20dp"
android:layout_marginStart="@dimen/dimen_20dp"
android:gravity="bottom"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:id="@+id/cancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginEnd="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/secondary_button"
android:text="Cancel"
android:textColor="@color/white" />

<Button
android:id="@+id/btn_proceed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginStart="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/primary_button"
android:text="Proceed"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>



AndroidManifest.xml




  <activity
android:windowSoftInputMode="adjustResize"
android:name=".ui.main.MainActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar"></activity>


I have a fragment call reload fragment that was attached above. Parent activity is MainActivity here I attached manifest file code which related to activity.When I click in the edittext bottom buttons cover edittext fields with the keyboard. Here I added android:fitsSystemWindows property in the manifest file. Is there anything missing my code?T hanks in advanced.










share|improve this question

























  • did you tried with android:windowSoftInputMode="adjustPan"

    – Mr.Bunny
    Nov 26 '18 at 5:38











  • @BunnyYes, Same Result.

    – Rajitha Perera
    Nov 26 '18 at 5:42











  • Makes sense. It is the parent Activity that has to set android:fitsSystemWindows, not the child fragment.

    – lionscribe
    Nov 26 '18 at 5:43











  • @lionscribe you mean that "android:fitsSystemWindows="true"" should put in parent activity layout ?

    – Rajitha Perera
    Nov 26 '18 at 5:46






  • 1





    @RajithaPerera add scroll view in your XML.

    – nimi0112
    Nov 26 '18 at 6:18
















0












0








0









Image
enter image description here



Fragment Layout




<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:background="@drawable/fragments_background"
tools:context=".ui.fragments.BillPaymentFragment">

<LinearLayout
android:id="@+id/wallet"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/wolletColor"
android:orientation="horizontal">

<ImageView
android:layout_width="@dimen/dimen_50dp"
android:layout_height="@dimen/dimen_50dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dimen_20dp"
android:background="@drawable/wallet" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="@dimen/dimen_4dp"
android:orientation="vertical">

<TextView
android:id="@+id/wallet_remains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dimen_10dp"
android:text="3450.00 LKR"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/dimen_16dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wallet_remains"
android:textColor="@color/gray"
android:textSize="@dimen/dimen_12dp" />
</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingTop="@dimen/dimen_60dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:padding="@dimen/dimen_20dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="Mobile No"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_mobile_number"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="@dimen/dimen_20dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/mobile_number"
android:inputType="phone"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="@string/amount"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_amount"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/amount_hint"
android:inputType="number"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

</LinearLayout>


</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dimen_20dp"
android:layout_marginStart="@dimen/dimen_20dp"
android:gravity="bottom"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:id="@+id/cancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginEnd="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/secondary_button"
android:text="Cancel"
android:textColor="@color/white" />

<Button
android:id="@+id/btn_proceed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginStart="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/primary_button"
android:text="Proceed"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>



AndroidManifest.xml




  <activity
android:windowSoftInputMode="adjustResize"
android:name=".ui.main.MainActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar"></activity>


I have a fragment call reload fragment that was attached above. Parent activity is MainActivity here I attached manifest file code which related to activity.When I click in the edittext bottom buttons cover edittext fields with the keyboard. Here I added android:fitsSystemWindows property in the manifest file. Is there anything missing my code?T hanks in advanced.










share|improve this question

















Image
enter image description here



Fragment Layout




<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:background="@drawable/fragments_background"
tools:context=".ui.fragments.BillPaymentFragment">

<LinearLayout
android:id="@+id/wallet"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/wolletColor"
android:orientation="horizontal">

<ImageView
android:layout_width="@dimen/dimen_50dp"
android:layout_height="@dimen/dimen_50dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dimen_20dp"
android:background="@drawable/wallet" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="@dimen/dimen_4dp"
android:orientation="vertical">

<TextView
android:id="@+id/wallet_remains"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dimen_10dp"
android:text="3450.00 LKR"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/dimen_16dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wallet_remains"
android:textColor="@color/gray"
android:textSize="@dimen/dimen_12dp" />
</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingTop="@dimen/dimen_60dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:padding="@dimen/dimen_20dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="Mobile No"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_mobile_number"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="@dimen/dimen_20dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/mobile_number"
android:inputType="phone"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dimen_10dp"
android:text="@string/amount"
android:textColor="@color/borderAndFont"
android:textSize="@dimen/dimen_20dp"></TextView>

<EditText
android:id="@+id/reload_amount"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/rounded_edit_text"
android:gravity="center|center_vertical"
android:hint="@string/amount_hint"
android:inputType="number"
android:textColor="@color/borderAndFont"
android:textSize="14sp" />

</LinearLayout>


</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_marginEnd="@dimen/dimen_20dp"
android:layout_marginStart="@dimen/dimen_20dp"
android:gravity="bottom"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">

<LinearLayout

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:id="@+id/cancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginEnd="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/secondary_button"
android:text="Cancel"
android:textColor="@color/white" />

<Button
android:id="@+id/btn_proceed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10dp"
android:layout_marginStart="@dimen/dimen_6dp"
android:layout_marginTop="@dimen/dimen_10dp"
android:layout_weight="1"
android:background="@drawable/primary_button"
android:text="Proceed"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>



AndroidManifest.xml




  <activity
android:windowSoftInputMode="adjustResize"
android:name=".ui.main.MainActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar"></activity>


I have a fragment call reload fragment that was attached above. Parent activity is MainActivity here I attached manifest file code which related to activity.When I click in the edittext bottom buttons cover edittext fields with the keyboard. Here I added android:fitsSystemWindows property in the manifest file. Is there anything missing my code?T hanks in advanced.







android android-layout android-softkeyboard






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 5:40







Rajitha Perera

















asked Nov 26 '18 at 5:33









Rajitha PereraRajitha Perera

59531229




59531229













  • did you tried with android:windowSoftInputMode="adjustPan"

    – Mr.Bunny
    Nov 26 '18 at 5:38











  • @BunnyYes, Same Result.

    – Rajitha Perera
    Nov 26 '18 at 5:42











  • Makes sense. It is the parent Activity that has to set android:fitsSystemWindows, not the child fragment.

    – lionscribe
    Nov 26 '18 at 5:43











  • @lionscribe you mean that "android:fitsSystemWindows="true"" should put in parent activity layout ?

    – Rajitha Perera
    Nov 26 '18 at 5:46






  • 1





    @RajithaPerera add scroll view in your XML.

    – nimi0112
    Nov 26 '18 at 6:18





















  • did you tried with android:windowSoftInputMode="adjustPan"

    – Mr.Bunny
    Nov 26 '18 at 5:38











  • @BunnyYes, Same Result.

    – Rajitha Perera
    Nov 26 '18 at 5:42











  • Makes sense. It is the parent Activity that has to set android:fitsSystemWindows, not the child fragment.

    – lionscribe
    Nov 26 '18 at 5:43











  • @lionscribe you mean that "android:fitsSystemWindows="true"" should put in parent activity layout ?

    – Rajitha Perera
    Nov 26 '18 at 5:46






  • 1





    @RajithaPerera add scroll view in your XML.

    – nimi0112
    Nov 26 '18 at 6:18



















did you tried with android:windowSoftInputMode="adjustPan"

– Mr.Bunny
Nov 26 '18 at 5:38





did you tried with android:windowSoftInputMode="adjustPan"

– Mr.Bunny
Nov 26 '18 at 5:38













@BunnyYes, Same Result.

– Rajitha Perera
Nov 26 '18 at 5:42





@BunnyYes, Same Result.

– Rajitha Perera
Nov 26 '18 at 5:42













Makes sense. It is the parent Activity that has to set android:fitsSystemWindows, not the child fragment.

– lionscribe
Nov 26 '18 at 5:43





Makes sense. It is the parent Activity that has to set android:fitsSystemWindows, not the child fragment.

– lionscribe
Nov 26 '18 at 5:43













@lionscribe you mean that "android:fitsSystemWindows="true"" should put in parent activity layout ?

– Rajitha Perera
Nov 26 '18 at 5:46





@lionscribe you mean that "android:fitsSystemWindows="true"" should put in parent activity layout ?

– Rajitha Perera
Nov 26 '18 at 5:46




1




1





@RajithaPerera add scroll view in your XML.

– nimi0112
Nov 26 '18 at 6:18







@RajithaPerera add scroll view in your XML.

– nimi0112
Nov 26 '18 at 6:18














1 Answer
1






active

oldest

votes


















1














Adding android:fitsSystemWindows="true and android:windowSoftInputMode="adjustResize" to the Main Activity won't work.



You have to add android:fitsSystemWindows="true to the parent layout of that particular Fragment xml file. And in the java class of the Fragment in your onCreateView you have to add windowSoftInputMode like this.



getActivity()
.getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);


Hope this works for you. Let me know if you have any issue.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475237%2fandroidfitssystemwindows-not-working-on-fragment%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Adding android:fitsSystemWindows="true and android:windowSoftInputMode="adjustResize" to the Main Activity won't work.



    You have to add android:fitsSystemWindows="true to the parent layout of that particular Fragment xml file. And in the java class of the Fragment in your onCreateView you have to add windowSoftInputMode like this.



    getActivity()
    .getWindow()
    .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);


    Hope this works for you. Let me know if you have any issue.






    share|improve this answer




























      1














      Adding android:fitsSystemWindows="true and android:windowSoftInputMode="adjustResize" to the Main Activity won't work.



      You have to add android:fitsSystemWindows="true to the parent layout of that particular Fragment xml file. And in the java class of the Fragment in your onCreateView you have to add windowSoftInputMode like this.



      getActivity()
      .getWindow()
      .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);


      Hope this works for you. Let me know if you have any issue.






      share|improve this answer


























        1












        1








        1







        Adding android:fitsSystemWindows="true and android:windowSoftInputMode="adjustResize" to the Main Activity won't work.



        You have to add android:fitsSystemWindows="true to the parent layout of that particular Fragment xml file. And in the java class of the Fragment in your onCreateView you have to add windowSoftInputMode like this.



        getActivity()
        .getWindow()
        .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);


        Hope this works for you. Let me know if you have any issue.






        share|improve this answer













        Adding android:fitsSystemWindows="true and android:windowSoftInputMode="adjustResize" to the Main Activity won't work.



        You have to add android:fitsSystemWindows="true to the parent layout of that particular Fragment xml file. And in the java class of the Fragment in your onCreateView you have to add windowSoftInputMode like this.



        getActivity()
        .getWindow()
        .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);


        Hope this works for you. Let me know if you have any issue.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 6:14









        Savin SharmaSavin Sharma

        436316




        436316
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475237%2fandroidfitssystemwindows-not-working-on-fragment%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Create new schema in PostgreSQL using DBeaver

            Deepest pit of an array with Javascript: test on Codility

            Fotorealismo