小编pun*_*waj的帖子

如何在android中隐藏软键盘

我正在使用我的应用程序中的编辑文本字段.当我点击它时出现软键盘.但是当我点击"完成"按钮(在软键盘上)时,它应该消失但它不会消失.我将输入类型设置为布局文件中的文本.我想按下按钮时隐藏软键盘.请帮忙.谢谢.

这是我的代码.

public class locupdate extends MapActivity implements OnDoubleTapListener{

    GeoPoint p,geoPoint;
    MapView SearchMap;
    List<Overlay> list;
    MapController map_controller;
    LocationManager locationManager;
    Location location,update_location ;
    MyLocationOverlay me;
    Button go_btn,done;
    String city;
    int cid;
    Double lat_update,lng_update;
    EditText location_entered;
    @Override
    public void onCreate(Bundle savedInstanceState){

        super.onCreate(savedInstanceState);
        setContentView(R.layout.bingmapupdate);
        go_btn=new Button(getApplicationContext());
        go_btn=(Button)findViewById(R.id.go_button);

        location_entered=(EditText)findViewById(R.id.enterLocationforSearch); 
        location_entered.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                location_entered.setText("");

            }
        });
        done=new Button(getApplicationContext());
        done=(Button)findViewById(R.id.button_locationUpdateDone);
        done.setEnabled(false);
        done.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                SharedPreferences.Editor editor=preferences.edit();
                String memberid=preferences.getString("unique_userName", null);

                String …
Run Code Online (Sandbox Code Playgroud)

android hide android-softkeyboard android-edittext

1
推荐指数
1
解决办法
5132
查看次数