Bottom TabLayout располагается поверх клавиатуры - PullRequest
0 голосов
/ 03 декабря 2018

В приложении, которое я разрабатываю, у меня есть TabLayout и ViewPager на моем MainActivity.

Проблема в том, что каждый раз, когда я нажимаю на что-то, что требует ввода (поэтому клавиатура приходитвверх), что TabLayout придерживается верхней части клавиатуры.Я бы хотел, чтобы он оставался там, где он есть - это значит, что он будет скрыт клавиатурой.

Проблема выражена на этом скриншоте.Я не жду, когда она перейдет к верхней части клавиатуры.

enter image description here

Мой файл манифеста находится здесь (я пробовал различные комбинациииз adjustNothing, adjustPan, adjustResize ...):

<!--
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but you must specify either coarse or fine
     location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:name=".PinUpApplication"
    android:allowBackup="true"
    android:icon="@mipmap/pinup"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/pinup_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:windowSoftInputMode="adjustPan">

    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/.
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity android:name=".Activities.MainActivity"
        android:windowSoftInputMode="adjustPan|adjustResize"
        android:screenOrientation="portrait">
    </activity>
    <activity android:name=".Activities.HorecaActivity"
        android:screenOrientation="portrait"/>
    <activity android:name=".Activities.HorecaMainActivity"
        android:screenOrientation="portrait"/>
    <activity android:name=".Activities.EditProfileActivity"
        android:screenOrientation="portrait"/>
    <activity android:name=".Activities.PersonProfileActivity"
        android:screenOrientation="portrait"/>
    <activity android:name=".Activities.LoginActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Activities.RegisterActivity"
        android:screenOrientation="portrait">
    </activity>
    <activity android:name=".Activities.NoNetworkActivity"
        android:screenOrientation="portrait"></activity>
    <meta-data android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id"/>

    <activity android:name="com.facebook.FacebookActivity"
        android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />
    <activity
        android:name="com.facebook.CustomTabActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
    </activity>
</application>

А вот ниже коддля деятельности:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/white">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_scrollFlags="enterAlways">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:windowActionModeOverlay="false"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_search"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"
            android:gravity="center_vertical"
            android:visibility="gone"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </FrameLayout>

</android.support.design.widget.AppBarLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <ro.ineedhelp.pinup.Utils.NonSwipeableViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

</LinearLayout>

<FrameLayout
    android:id="@+id/main_pager"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:windowSoftInputMode="adjustPan|adjustResize"
    android:layout_gravity="bottom"
    android:layout_alignParentBottom="false">
    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        style="@style/MyCustomTabLayout"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/white"
        app:tabIndicatorColor="@color/colorPrimary"
        app:tabIconTint="@color/grey_600"
        app:tabTextColor="@color/grey_600"/>
</FrameLayout>

<include
    layout="@layout/sheet_activity_map"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    app:layout_behavior="@string/bottom_sheet_behavior" />

1 Ответ

0 голосов
/ 03 декабря 2018

Попробуйте, для вашей основной активности в файле манифеста.

android: windowSoftInputMode = "stateAlwaysHidden | AdjustPan"

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...