我正在使用recyclerview和一个EditText,用于在recyclerview中进行过滤。我使用adjustpan在软键盘上查看Edittext。当键盘打开时,我的recyclerview上升并将第一行切成近一半。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativemain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:layout_below="@+id/include"
android:layout_marginTop="-20dp"/>
<include
android:id="@+id/include2"
layout="@layout/setting_header"/>
<include
android:id="@+id/notifyBlue"
layout="@layout/notify_bluetooth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/include"
android:layout_alignParentTop="true"/>
<include
android:id="@+id/include"
layout="@layout/header"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/include2"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:id="@+id/recycleView"
android:visibility="visible"
android:layout_above="@+id/etSearch"
android:padding="5dp"
android:layout_below="@+id/include" />
<ImageView
android:id="@+id/imgbackbutton"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="@drawable/circle_purpleforbutton"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="4dp"
android:paddingTop="5dp"
android:src="@drawable/menu_button"
android:layout_above="@+id/etSearch"
android:layout_marginBottom="20dp" />
<include
android:id="@+id/rlFooter"
layout="@layout/footer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<ProgressBar
android:id="@+id/pBarMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone"/>
<com.StampWallet.customClasses.FocusClearingEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/etSearch"
android:layout_above="@+id/rlFooter"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:hint="type to search a store"
android:inputType="text"
android:gravity="center_horizontal"
android:background="@android:color/white"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp"
android:textColor="#000"
android:visibility="gone" />
</RelativeLayout>
任何帮助?
答案 0 :(得分:1)
我找到了解决方案。
我已经采取了哪些措施来解决这个问题..我已将android:windowSoftInputMode="adjustResize"
添加到我在Manifest中的活动中。
隐藏并显示我的标题和用户信息视图,因为软键盘打开和关闭....
我的EditText搜索列表器
etSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if (b) {
if (include != null)
include.setVisibility(View.GONE);
if (include2 != null)
include2.setVisibility(View.GONE);
if (notifyView != null)
notifyView.setVisibility(View.GONE);
} else {
if (include != null)
include.setVisibility(View.VISIBLE);
if (include2 != null)
include2.setVisibility(View.VISIBLE);
}
}
});
这解决了我的问题
答案 1 :(得分:0)
添加&#34; adjustresize&#34;你的清单将解决问题
机器人:windowSoftInputMode =&#34; adjustResize&#34;
答案 2 :(得分:0)
将此属性添加到AndroidManifest.xml文件中。这样可以解决您的问题。
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.css" rel="stylesheet"/>
<!-- Header -->
<header class="ui secondary menu">
<div class="ui container">
<a class="item" href="#">JSFiddle</a>
<div class="right menu">
<a class="item" href="#">
<div class="ui green button">Sign up</div>
</a>
<a class="item" href="#">Log in</a>
</div>
</div>
</header>
<!-- Page Content -->
<main class="content">
<div class="ui container segment">
<div class="ui relaxed divided padded full grid">
<div class="row">
<div class="column">
<h1 class="ui header">
<div class="content">
Contact
</div>
</h1>
</div>
</div>
<div class="ui divider"></div>
<div class="row">
<div class="eleven wide column">
<form class="ui form" novalidate>
<div class="field">
<div class="two fields">
<div class="field">
<label>Name</label>
<input type="text" name="name" />
</div>
<div class="field">
<label>Email address <span class="disabled-text">(Required)</span></label>
<input type="text" name="email" />
</div>
</div>
</div>
<div class="field">
<label>Subject</label>
<input type="text" name="subject" />
</div>
<div class="field">
<label>Message <span class="disabled-text">(Required)</span></label>
<textarea rows="5" name="text"></textarea>
</div>
<button type="submit" class="ui green button">Send request</button>
</form>
</div>
<div class="five wide column">
<h5 class="ui dividing header">
<i class="bug icon"></i>
<div class="content">
Report a bug
</div>
</h5>
<div class="ui list">
<div class="item">
<i class="info icon"></i>
<div class="content">
Provide as much information as possible.
</div>
</div>
<div class="item">
<i class="info icon"></i>
<div class="content">
Explain exactly what has happened and what steps should we take to reproduce the problem.
</div>
</div>
</div>
<h5 class="ui dividing header">
<i class="comments outline icon"></i>
<div class="content">
Contacts
</div>
</h5>
<div class="ui relaxed list">
<div class="item">
<div class="content">
<div class="header">John Doe</div>
<div class="description">
john.doe@jsfiddle.com
</div>
</div>
</div>
<div class="item">
<div class="content">
<div class="header">Jane Doe</div>
<div class="description">
jane.doe@jsfiddle.com
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="footer ui vertical segment">
<div class="ui divider"></div>
<div class="ui container">
<div class="ui right floated horizontal list">
<a class="item" href="#">Features</a>
<a class="item" href="#">Contact</a>
</div>
<div class="ui horizontal list">
<div class="disabled item">Copyright © 2016 JSFiddle.</div>
</div>
</div>
</footer>