当前位置:网站首页>Searchview click failure
Searchview click failure
2022-06-26 10:19:00 【?? FW?】
Android Of SearchView Realize click jump
SearchView yes android Native search box control , When writing a project, you need to achieve a search box click effect similar to Taobao ( Click the search box to jump to a new activity Implement search ), Some implementations of the search box on the home page are designed by ourselves ( use Textview and Button Those designed by themselves UI), In the spirit of laziness ! Direct use SearchView Jump to the home page .
problem
SearchView Of setOnClick It doesn't work ,SearchView I've tried all the listening events , Those who lose focus have tried ( You may have problems with your own operation ), It is always impossible to click SearchView You can jump anywhere in the , You can only click on that SearchIcon To jump , After a long time , Finally, I found a local way on the Internet , So let's define one FrameLayout( Control is always in the upper left corner ), Then add SearchView and View( The two should be the same size ), And then put SearchView Of focusable Set to false, Finally, give View A monitor ( Click jump event ) became .
Code (XML)
<FrameLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<SearchView
android:id="@+id/sv"
android:layout_width="match_parent"
android:layout_height="40dp"
android:focusable="false"
android:queryHint=" Click on the search "
android:iconifiedByDefault="false"/>
<View
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="40dp" />
</FrameLayout>
边栏推荐
- exec系列函数(execl、execlp、execle、execv、execvp)使用
- MySQL第十三次作业-事务管理
- Openxcap usage
- 瑞萨电子面向物联网应用推出完整的智能传感器解决方案
- Blog post index summary --c #
- 自动化测试——关于unitest与pytest初始化共存问题
- Cloud native essay using Hana expression database service on Google kubernetes cluster
- 存储过程测试入门案例
- Get the clicked position in the recyclerview
- 創建對象的時候堆內存的分配
猜你喜欢

jar版本冲突问题解决

exec系列函数(execl、execlp、execle、execv、execvp)使用

MySQL learning summary

【Leetcode】76. 最小覆盖子串

Software testing - how to select the appropriate orthogonal table

Small example of SSM project, detailed tutorial of SSM integration

String constant pool, class constant pool, and runtime constant pool

Basic string operations in C

SSM项目小例子,SSM整合图文详细教程

Configuration internationale
随机推荐
Standard implementation of streaming layout: a guide to flexboxlayout
如何更改微信小程序二维码物料颜色
mysql学习总结
A list of common methods for customizing paint and canvas of view
首批12家企业入驻!广州首个集中展销老字号产品专柜开张
Automated testing -- Introduction and use of pytest itself and third-party modules
利用foreach循环二维数组
What is the web SSH service port of wgcloud
Openxcap usage
Custom interceptor
Allocation de mémoire tas lors de la création d'objets
Some problems to be considered when designing technical implementation scheme
WGCLOUD的web ssh服务端口是多少
Automated testing -- on the coexistence of Unitest and pytest initialization
Cmake / set command
Configuration internationale
What is LSP
String constant pool, class constant pool, and runtime constant pool
Blog article index summary -- Software Engineering
Small example of SSM project, detailed tutorial of SSM integration