AutocompleteTextView 建议列表上升 [英] AutocompleteTextView suggestion list goes up

查看:29
本文介绍了AutocompleteTextView 建议列表上升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复Android:自动完成文本视图,文本视图上方显示建议列表?

当建议列表由用户滚动时,我正在完全尝试在键盘上显示重叠的建议列表,但它始终打开.

I am fully trying to display suggestion list overlapping on keyboard when suggestion list scroll by user but it always open up side.

这里我是这样的

这是我的清单文件

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

    <uses-sdk android:minSdkVersion="8" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:label="@string/app_name"
            android:name=".SuggestionListActivity" 
            android:windowSoftInputMode="adjustResize|adjustPan|stateHidden">
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

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

这是我的 main.xml 文件

here is my main.xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" android:padding="10dp">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" 
        android:layout_margin="10dp"/>

    <TextView android:layout_margin="10dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="This is testing for the auto complete textview in this application to display suggestion list overlapping on keyboard." />

    <AutoCompleteTextView android:id="@+id/autocomplete"
            android:layout_width="fill_parent" android:layout_margin="5dp"
            android:layout_height="wrap_content" android:hint="Search"
            android:layout_marginLeft="5dp" android:dropDownHeight="300dp"
            android:inputType="textAutoComplete" android:singleLine="true"
            />

</LinearLayout>

在此代码中如何在列表为焦点时在键盘上显示建议.

what to do in this code to display the suggestion over keyboard when list was focus.

推荐答案

我以前遇到过这个问题.对我来说,AutocompleteTextView 上方的屏幕空间比下方多(在普通"设备上测试),因此列表向上打开.我稍微调整了布局,以便 AutocompleteTextView 下方有更多空间,然后它开始向下打开.这就是为我修复它的原因.

I've had this problem before. For me, there was more screen space above the AutocompleteTextView than below (testing on a "normal" device), so the list opened upwards. I adjusted my layout slightly so that there was more space below the AutocompleteTextView and it started opening downwards. That's what fixed it for me.

这篇关于AutocompleteTextView 建议列表上升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆