我在谷歌开发者的这篇文章中使用工具栏(appcompat-v21)
它完美无缺,除非我按下editText.我在清单中设置:
android:windowSoftInputMode="adjustPan"
Run Code Online (Sandbox Code Playgroud)
但是当键盘位于我的editText下时,工具栏会移出屏幕.
有办法解决这个问题吗?
编辑:adjustResize不适用于Lollipop和Kitkat,在JB中.
EDIT2:它是由:当我设置为true时引起的.
android toolbar android-appcompat android-edittext adjustpan
我试图通过fitsSystemWindows ="true"获得半透明导航栏.它在kitkat中运行良好,半透明导航栏使用android:clipToPadding ="false"显示内容.但Lollipop导航栏不显示内容.
图像: 导航抽屉关闭
这是xml:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="false"
tools:context=".MainActivity">
<!-- The main content view -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Your main content -->
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="8dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<Button
android:layout_marginTop="24dp"
android:background="@color/md_red_500"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="800dp" />
</LinearLayout>
<!-- The navigation drawer -->
<com.videum.javier.myapplicationeliminmar.ScrimInsetsFrameLayout
android:clipToPadding="false"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scrimInsetsFrameLayout"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:elevation="10dp"
android:fitsSystemWindows="true"
app:insetForeground="#4000">
<!-- Your drawer content -->
<Button
android:layout_marginTop="24dp"
android:background="@color/md_red_500"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="800dp" />
</com.videum.javier.myapplicationeliminmar.ScrimInsetsFrameLayout>
Run Code Online (Sandbox Code Playgroud)
这是风格(相同的v19和v21):
<style name="AppTheme" …Run Code Online (Sandbox Code Playgroud)