【问题标题】:The searchview goes upwards behind the toolbar when keyboard opens how to show the search view when typing?键盘打开时搜索视图在工具栏后面向上移动如何在键入时显示搜索视图?
【发布时间】:2021-03-10 04:42:39
【问题描述】:

当我尝试输入 searchview 时,searchview 在工具栏后面向上移动并且不可见

 <?xml version="1.0" encoding="utf-8"?>
   <layout 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">
   <data>
    <variable name="homeviewmodel" type="com.nads.epicureapp.ui.homepage.HomeViewModel"/>
   </data>
 
  <androidx.constraintlayout.widget.ConstraintLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
   tools:context=".ui.homepage.searchfoodsdir.SearchFoods">

<SearchView
    android:id="@+id/serchcooksfoods"
    android:layout_width="319dp"
    android:layout_height="73dp"
    android:layout_marginTop="16dp"
    android:background="#1BF1F1"
    android:iconifiedByDefault="false"
    android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.183" />

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/searchfoodslist"
    android:layout_width="match_parent"
    android:layout_height="501dp"
    android:layout_marginTop="28dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/serchcooksfoods" />

 </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

并且搜索视图不可见如何在我输入时使搜索视图可见和工作

【问题讨论】:

    标签: android android-studio android-layout kotlin searchview


    【解决方案1】:

    在清单文件的活动标签中使用它

    android:windowSoftInputMode="adjustPan"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多