2011-06-02 64 views
2

直到Nexus S手机的2.3.4更新之后,我才看到此问题。忽略Android Nexus S EditText设置(2.3.4)

我有一个非常简单的应用程序,加载应用程序启动时的主要活动。

这个主要活动有一个由一些TextViews和EditText组成的LinearLayout,一对Spinners和一个Button。

我现在遇到了EditText的输入问题。它应该提供一个带有手机输入类型的软键盘。相反,它提供了标准的字母数字软键盘,一旦你开始输入输入,它会将它传递给Google搜索应用程序,并且根本不填写EditText。

如果我转到我的设置活动并向后导航,EditText功能正常。

我不能为我的生活弄清楚这里发生了什么问题,并且在2.3.4更新手机上宣布这是一个问题。

活动代码:

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()); 
} 

在那里,我试图迫使焦点,密码屏蔽,手机输入型的第一措施,看看我是否可以修复它。这些不会改变任何行为,并且可以忽略,因为问题开始时他们不在那里。

布局

<?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" /> 

回答

1

我认为这是一个错误。我有同样的问题与2.3.3,2.3.4和NookColor 1.20设置

android:inputType="number" 

它显示在手机的软键盘,而不是数量的软键盘的时候。