【发布时间】:2015-07-21 16:51:30
【问题描述】:
我用AppBarLayout 和Toolbar 实现了CoordinatorLayout,以在滚动时隐藏工具栏,一切正常。
当我实现搜索视图时出现问题。
这是我的activity_main 布局:
<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">
<FrameLayout
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<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">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<View
android:id="@+id/appbar_bottom"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/transparent"
android:visibility="invisible"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
还有我的fragment_layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/projects_swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/projects_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
</android.support.v4.widget.SwipeRefreshLayout>
正常布局RecyclerView
隐藏键盘时的问题。
【问题讨论】:
-
如何隐藏键盘?
-
默认是按返回键或点击搜索图标时。
-
您的应用程序是否在 Android Manifest 文件中设置此标志:android:windowSoftInputMode="adjustResize"
-
不,我没有设置任何东西。
标签: android android-softkeyboard android-recyclerview android-design-library