1

ここに私のフラグメントクラスがあります:

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

Fragment がロードされ、EDitText (Lat) が選択されている場合 (Get Focused)、KeyBoard は表示されません。キーボードを表示するには?

4

1 に答える 1

0

次の行を追加します。

Lat.clearFocus();

行の直後:

Lat = (EditText) InflaterView.findViewById(R.id.LatitudeEdit); 
于 2013-01-22T00:15:57.583 に答える