Android - Make whole search bar clickable

前端 未结 12 1942
情深已故
情深已故 2020-12-29 18:14

I am using a search-view element in my fragment to implement search feature.



        
12条回答
  •  感情败类
    2020-12-29 19:18

    What is the clickable mean? trigger search action or just make the edit area focused? If it is the first, you can just make the icon clickable=false. and make the whole layout clickable and implement a event listener.

    
    

    The onClick method should be

    public void onClick(View v) {
       InputMethodManager im = ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE));
        im.showSoftInput(editText, 0);
    }
    

提交回复
热议问题