zoukankan      html  css  js  c++  java
  • edittext把软键盘上的回车键改为搜索、发送或者 下一步,窗口随软键盘弹出而改变。

    http://m.blog.csdn.net/article/details?id=51350501

    以上博文讲解很详细。

    如图所示,有时候为了布局美观,在搜索时没有搜索按钮,而是调用软件盘上的按钮。调用的实现只需要在XML在输入框中加入Android:imeOptions="actionSearch",另外,还要设置android:singleLine="true",保证点击不会换行,最后调用软键盘时,回车键就会显示搜索二字。

    然后调用 OnEditorActionListener,不是OnKeyListener


    在CODE上查看代码片
    派生到我的代码片
    1. et_search.setOnEditorActionListener(new TextView.OnEditorActionListener() {  
    2.     @Override  
    3.     public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {  
    4.         if (actionId == EditorInfo.IME_ACTION_SEARCH){  
    5.             isSearch = true;  
    6.             page = 1;  
    7.             MyUtils.hideSoftKeyboard(EnterShopActivity.this,v);  
    8.             getData();  
    9.             return true;  
    10.         }  
    11.         return false;  
    12.     }  
    13. });  
  • 相关阅读:
    go笔记
    脚本
    php-log
    idea maven scala
    Corporative Network
    uva1160
    比map更强大的multimap
    Message Decowding
    kmp 的next 数组求法
    Nearest Common Ancestors
  • 原文地址:https://www.cnblogs.com/epmouse/p/6237274.html
Copyright © 2011-2022 走看看