简体   繁体   English

键盘打开时搜索视图在工具栏后面向上移动如何在键入时显示搜索视图?

[英]The searchview goes upwards behind the toolbar when keyboard opens how to show the search view when typing?

When i am trying to type in searchview the searchview goes upwards behind the toolbar and is not visible当我尝试输入 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>

and the searchview cant be visible how to make searchview visible and working when i am typing并且搜索视图不可见如何在我输入时使搜索视图可见和工作

Use this in the activity tag in the manifest file在清单文件的活动标签中使用它

android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM