Android 3.0 操作栏搜索 View

标签 android search android-3.0-honeycomb

在 3.0 平板电脑 gmail 应用程序中,当我单击搜索按钮(在操作栏上)时,它会向右移动并占用整个操作栏。我怎样才能做到这一点?我能想到的唯一方法是在单击搜索按钮时隐藏所有其他自定义操作栏字段。有没有更简单的方法? 谢谢。

最佳答案

您必须添加一个操作 View 。您可以控制操作栏的哪些元素在菜单布局中没有位置时自动“隐藏”使用 android:showAsAction="always"

检查 action bar documentation对于一些 sample 。

关于Android 3.0 操作栏搜索 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5583435/

相关文章:

Android 以编程方式插入的短信在消息应用程序中的时间戳不正确

android - 流式传输 .m3u 音频

python - 在 python 中搜索通配符的字符串并返回匹配位置

android - 通知 Android 3.0

android - 当我弹出 BackStack 时,自定义 fragment 过渡动画无法正确播放

Android:WebView ActionBar( hive )?

android - 在协程内并行运行两个 Kotlin 协程

android - 如何在android中的进度条中添加两种颜色?

string - Boyer Moore 寻找小 key

php - 可变长度正则表达式回顾