gpt4 book ai didi

android - 键盘覆盖布局底部的搜索 View

转载 作者:行者123 更新时间:2023-11-29 19:52:15 25 4
gpt4 key购买 nike

layout screen

list 文件 android:windowSoftInputMode="adjustPan|adjustResize|stateVisible"当键盘显示和标题栏不应该熄灭时,我想在键盘顶部显示 serachview。有什么办法吗?XMl页面

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar
android:id="@+id/progress1"
style="@style/progressbar"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:visibility="gone"
app:mlpb_progress_color="@color/blue"
app:mlpb_progress_stoke_width="3dp" />

<!--<include
android:id="@+id/layoutTitle"
layout="@layout/title_bar" />-->

<SearchView
android:id="@+id/searchViewB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@color/row_bg_transparent_white"
android:padding="2dp"

android:queryHint="Search">

</SearchView>

<LinearLayout

android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/searchViewB"
android:layout_alignEnd="@+id/searchViewB"
android:layout_alignRight="@+id/searchViewB"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/layout_bg"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="5dp">

<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>

</LinearLayout>
</RelativeLayout>

最佳答案

根据需要使用此布局修改,即使没有任何 android:windowSoftInputMode

enter image description here enter image description here

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<ProgressBar
android:id="@+id/progress1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:visibility="gone" />

<SearchView
android:id="@+id/searchViewB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:padding="2dp"
android:queryHint="Search" >
</SearchView>

<ListView
android:id="@+id/serachitem"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/searchViewB" >
</ListView>
</RelativeLayout>

我的 list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="21" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name="com.example.test.Layouts"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

我的 Activity 课

 package com.example.test;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Layouts extends Activity {

private ArrayList<String> some;
private ListView list;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.searchview);

some = new ArrayList<String>();
for (int i = 0; i < 100; i++) {
some.add("Item" + i);
}

list = (ListView) findViewById(R.id.serachitem);

ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1, some);

list.setAdapter(adapter);
}
}

关于android - 键盘覆盖布局底部的搜索 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37021004/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com