1

this is what i want enter image description hereI am using the BottomsheetFragment what i want is the keyboard should be below the view . but in my case keyboard is overlaping the fragment view .

here is my xml file check my code here

and i am getting this output

overlapping keyboard

Nitin Zagade
  • 71
  • 1
  • 7

1 Answers1

0

I have created a sample app and tested on the bottomsheet xml provided by you. By adding android:windowSoftInputMode="stateAlwaysHidden|adjustResize" in manifest file did work.

So Manifest file looks as below.

  <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"
            android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

Alternatively you can set this attribute dynamically as well inside onCreate in Activity class as follows

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

I have tried both ways on an sample app

Shadow Droid
  • 1,696
  • 1
  • 12
  • 26
  • i have no issue with the activity . issue is when i have activity and that activity holds the BottomSheetFragment . in this case the fragment keyboard is giving me the issue – Nitin Zagade Jan 14 '19 at 11:38
  • Device Windows--->has Activity-->holds fragment-->in above case BottomSheetFragment. So Keyboard is associated with Window(i.e Activity which is root from application point of view.) – Shadow Droid Jan 14 '19 at 11:42
  • @NitinZagade As mentioned I tried the code in sample app. If you want I can post the screenshot. give me sometime. Bythe way just let me know if you are using any styles. kindly post your style.xml – Shadow Droid Jan 14 '19 at 12:03