问题描述
我没有看到这个问题,直到2.3.4更新的Nexus S的手机后。
I hadn't seen this issue until after the 2.3.4 update for the Nexus S phone.
我有一个非常简单的应用,与加载应用程序的启动主要活动。
I have a very simple application, with a main activity that loads on start of the application.
这主要活动有一个的LinearLayout包括一些TextViews,并EditText上,一对夫妇纱厂,和一个按钮。
This main activity has a LinearLayout consisting of some TextViews, and EditText, a couple Spinners, and a Button.
我现在有与输入到的EditText的问题。它应该拿出一个软键盘与手机输入类型。相反,它与标准的字母数字软键盘来了,一旦你开始打字输入时,它把这个给谷歌搜索应用程序,并在EditText上不填的。
I am now having an issue with the input to the EditText. It is supposed to come up with a soft keyboard with the phone input type. Instead it comes up with the standard alpha-numeric soft keyboard and once you start typing input, it passes this to the Google Search application, and does not fill in the EditText at all.
如果我去我的设置活动,妥善导航回来,EditText上的功能。
If I go to my settings activity and navigate back, the EditText functions properly.
我不能为我的生活弄清楚到底是怎么回事错在这里,和上午在与2.3.4更新电话本声明一个问题的边缘。
I can't for the life of me figure out what is going wrong here, and am on the verge of declaring this an issue with the 2.3.4 update for the phone.
活动code:
public class MainActivity extends Activity {
private boolean unregistered = false;
private Spinner location, time;
private Button submit;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
EditText pin = (EditText) findViewById(R.id.pfp_pin);
pin.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(debugMode) System.out.println("In onKeyListener for PIN");
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
return true;
}
return false;
}
public int getInputType() {
return InputType.TYPE_CLASS_PHONE;
}
});
pin.setTransformationMethod(new PasswordTransformationMethod());
pin.requestFocus();
location = (Spinner) findViewById(R.id.pfp_location);
ArrayAdapter<CharSequence> loc_adapter = ArrayAdapter.createFromResource(
this, R.array.pfp_locs, android.R.layout.simple_spinner_item);
loc_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
location.setAdapter(loc_adapter);
location.setOnItemSelectedListener(new LocOnItemSelectedListener());
time = (Spinner) findViewById(R.id.pfp_time);
ArrayAdapter<CharSequence> time_adapter = ArrayAdapter.createFromResource(
this, R.array.pfp_times, android.R.layout.simple_spinner_item);
time_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
time.setAdapter(time_adapter);
time.setOnItemSelectedListener(new TimeOnItemSelectedListener());
submit = (Button) findViewById(R.id.pfp_submit);
submit.setOnClickListener(new SubmitOnClickListener());
}
在那里我试图迫使焦点,密码屏蔽,手机输入类型的第一个措施,看看我是否可以修复它。这些不改变任何行为,因为他们不存在这一问题时开始可以忽略不计。
In there I tried forcing focus, password masking, and the phone input type as first measures to see if I could fix it. These don't change any behavior and could be ignored as they were not there when the issue began.
布局
<?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">
<ImageView
android:maxHeight="88sp"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:src="@drawable/header" android:layout_gravity="center" android:layout_height="wrap_content" android:layout_width="wrap_content"/>
<TextView android:id="@+id/pfp_pin_title"
android:text="@string/pfp_pin_title"
android:paddingLeft="14dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TextView>
<EditText android:id="@+id/pfp_pin"
android:text=""
android:password="true"
android:singleLine="true"
android:inputType="phone"
android:linksClickable="false"
android:imeOptions="actionDone"
android:autoLink="none"
android:nextFocusUp="@+id/pfp_time"
android:layout_gravity="top"
android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
<TextView android:id="@+id/pfp_loc_label"
android:text="@string/pfp_loc_label"
android:paddingLeft="14dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TextView>
<Spinner android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/pfp_location"
android:prompt="@string/pfp_location_s"
android:layout_marginBottom="5dp"></Spinner>
<TextView android:id="@+id/pbp_time_label"
android:layout_height="wrap_content"
android:text="@string/pfp_time_label"
android:paddingLeft="14dip"
android:layout_width="fill_parent"></TextView>
<Spinner android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/pfp_time"
android:prompt="@string/pfp_time_s"
android:layout_marginBottom="25dp"></Spinner>
<Button android:layout_width="wrap_content"
android:id="@+id/pfp_submit"
android:text="@string/pfp_submit_s"
android:layout_height="65dp"
android:nextFocusDown="@+id/pfp_pin"
android:layout_gravity="center_horizontal"></Button>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxHeight="50sp"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:src="@drawable/powered_by_reversed" />
推荐答案
我相信这是一个错误。我有2.3.3,2.3.4相同的问题,并NookColor 1.20设置时
I believe it is a bug. I have the same issue with 2.3.3, 2.3.4, and NookColor 1.20 when setting
android:inputType="number"
它显示在手机的软键盘代替数字软键盘。
It displays the phone soft keyboard instead of the number soft keyboard.
这篇关于Android的Nexus S的EditText上设置忽略(2.3.4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!