软键盘"德尔"关键在失败的EditText上图库部件 [英] Soft keyboard "del" key fails in EditText on Gallery widget

查看:201
本文介绍了软键盘"德尔"关键在失败的EditText上图库部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用Android SDK中2.2和测试上的谷歌Nexus One在Eclipse应用程序构建ID 20090920-1017。对于测试的目的,下面我使用的IMEAndroid键盘无根的手机上。

I am developing an application in Eclipse build ID 20090920-1017 using android SDK 2.2 and testing on a Google Nexus One. For the purposes of the tests below I am using the IME "Android keyboard" on a non-rooted phone.

我有一个EditText控件,它具有一些非常奇怪的行为。我可以输入文字,然后preSS的DEL键删除该文本;但之后,我进入一个空间字符时,Del键将不再是空格字符之前删除字符。

I have an EditText widget which exhibits some very strange behavior. I can type text, and then press the "del" key to delete that text; but after I enter a 'space' character, the "del" key will no longer remove characters before that space character.

一个例子讲千言万语,所以考虑以下两个非常简单的应用程序...

An example speaks a thousand words, so consider the following two incredibly simple applications...

例1:一个EditText中的LinearLayout部件:

Example 1: An EditText in a LinearLayout widget:


package com.example.linear.edit;

import android.app.Activity;
import android.os.Bundle;

import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.Gallery;
import android.widget.LinearLayout;

public class LinearEdit extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);        

        LinearLayout layout = new LinearLayout(getApplicationContext());
        layout.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.MATCH_PARENT, Gallery.LayoutParams.MATCH_PARENT));

        EditText edit = new EditText(getApplicationContext());
        layout.addView(edit, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 

        setContentView(layout);
    }
}

运行上面的应用程序,输入文字编辑榜样,那么preSS的Del键几次,直到整个句子被删除。一切工作正常。

Run the above application, enter text "edit example", then press the "del" key several times until the entire sentence is deleted. Everything Works fine.

现在考虑例子2:一个EditText在画廊小部件:

Now consider example 2: An EditText in a Gallery widget:


package com.example.gallery.edit;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Gallery;
import android.widget.LinearLayout;

public class GalleryEdit extends Activity
{
    private final String[] galleryData = {"string1", "string2", "string3"};

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);        

        Gallery gallery = new Gallery(getApplicationContext());

        gallery.setAdapter(new ArrayAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, galleryData)
        {
            @Override
            public View getView(int position, View convertView, ViewGroup parent)
            {
                LinearLayout layout = new LinearLayout(getApplicationContext());
                layout.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.MATCH_PARENT, Gallery.LayoutParams.MATCH_PARENT));

                EditText edit = new EditText(getApplicationContext());
                layout.addView(edit, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 

                return layout;
            }
        });

        setContentView(gallery);
    }
}

运行上面的应用程序,输入文字编辑榜样,那么preSS的Del键数次。如果您遇到同样的问题,因为我,那么你会发现,你不能删除以往空间字符。一切都没有得到很好的。

Run the above application, enter text "edit example", then press the "del" key several times. If you are getting the same problem as me then you will find that you can't deleted past the 'space' character. All is not well.

如果任何人都可以在这个问题上提供一些线索,我将AP最多preciative。

If anyone could shed some light on this issue I would be most appreciative.

问候

推荐答案

我结束了写我自己的画廊认为,即时通讯只是想寻找一个比AsyncTask的过渡动画线程更好的实现。至少我的EditText控件现在的工作。生病后一些样品code,一旦香港专业教育学院有它整理出来。如果任何人有兴趣在Android开发主题是:(荡,我只能发布一次链接)。所以,搜索软键盘DEL键上的EditText画廊失败,另一个链接是:
什么是动画工作者线程最好的方法?

I ended up writing my own gallery view, im just trying to look for a better implementation than asynctask for the transition animation threads. At least my edittext controls work now. Ill post up some sample code once ive got it sorted out. If anyones interested the android developers topics are: (Dang, I can only post once link). So search for "Soft keyboard "del" key fails in EditText on Gallery" and the other link is: What is best method for an animation worker thread?

这篇关于软键盘"德尔"关键在失败的EditText上图库部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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