在我设计的应用程序中,我的
MainActivity
有一个底部的TabLayout
和ViewPager
。问题是每次我点击需要输入的内容时(键盘弹出),TabLayout
会固定在键盘的顶部。我希望它保持原来的位置 - 这意味着它将被键盘隐藏。这个问题在这张截图中得到了体现。我不希望它到达键盘的顶部。
我的清单文件在这里(我已经尝试了各种组合的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" />