2013-01-21 37 views
1

這裏是我的片段類:鍵盤未顯示(不響應)時的EditText android的片段選擇

public class PrayerTimes extends Fragment { 
    EditText Lat; 
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
     // Inflate the layout for this fragment 

    InflaterView = inflater.inflate(R.layout.activity_prayer_times, container, false); 

    Lat = (EditText) InflaterView.findViewById(R.id.LatitudeEdit); 

    Lat.addTextChangedListener(new TextWatcher() 
    { 

public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { 
      // TODO Auto-generated method stub 
    } 

public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,int arg3) { 
     // TODO Auto-generated method stub 
     } 

public void afterTextChanged(Editable arg0) { 
     // TODO Auto-generated method stub 
     } 
    }); 

    return InflaterView; 
} 
的片段負載時

,並在EDITTEXT(緯度)被選中(獲取聚焦)沒有鍵盤被顯示。如何顯示鍵盤?

回答

0

加入這一行:

Lat.clearFocus(); 

行後:

Lat = (EditText) InflaterView.findViewById(R.id.LatitudeEdit); 
+0

我嘗試在仿真器無法正常工作。 – moja