how to add Go button in android SoftKeyBoard and its functionality?

前端 未结 4 815
渐次进展
渐次进展 2021-02-06 04:26

i want to put \"Go\" button in android appliation softkeyboard

for search and other related scenarios can any one guide me how to achieve this? with example.

any

4条回答
  •  忘掉有多难
    2021-02-06 05:08

    I am doing same this for "send":

    Use this class in your layout :

    public class ActionEditText extends EditText { public ActionEditText(Context context) { super(context); }

    public ActionEditText(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }
    
    public ActionEditText(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
    }
    
    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs)
    {
        InputConnection conn = super.onCreateInputConnection(outAttrs);
        outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
        return conn;
    }
    

    }

    In xml:

    
    

提交回复
热议问题