在ListView的BaseAdapter的EditText怪异的行为 [英] EditText weird behaviour in ListView BaseAdapter

查看:196
本文介绍了在ListView的BaseAdapter的EditText怪异的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListView,使用 BaseAdapter 填充。
在ListView项目有一个数字的EditText:

I got a ListView, populated using BaseAdapter. In the listview Item there's a numeric EditText:

...
            <EditText
                android:id="@+id/edit_quantita"
                android:layout_width="50dp"
                android:layout_height="30dp"
                android:layout_gravity="center"
                android:layout_marginTop="5dp"
                android:background="@drawable/edit_quantita"
                android:gravity="center_vertical|center_horizontal"
                android:inputType="number"
                android:text="1"
                android:textColor="#fff"
                tools:ignore="HardcodedText" >

            </EditText>
...

当我在这的EditText敲击数字键盘提示瞬间,然后它突然一个普通字符叠加键盘。如果我尝试写这个键盘没有文字显示的任何位置上的东西。
奇怪的是,如果我在Editext再次点击它的行为,因为它应该只显示工作数字键盘。

When I tap on this EditText the numerical keyboard prompts for an instant, and then it's suddenly overlayed by a regular character keyboard. If I try to write something on this keyboard no text is shown anywhere. Curiously, if I tap again on the Editext it behaves as it should, showing only the working numerical keyboard.

我能做些什么?

推荐答案

的实施的EditText 的ListView <使用时有许多缺陷/ code>。尝试添加这块code在你的的onCreate()

int apiVersion = android.os.Build.VERSION.SDK_INT;
if (apiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
else
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

这篇关于在ListView的BaseAdapter的EditText怪异的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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