2011-06-02 65 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" 

它顯示在手機的軟鍵盤,而不是數量的軟鍵盤的時候。