在3.0之前的设备上引用android.R.id.home [英] Reference android.R.id.home on pre 3.0 devices

查看:120
本文介绍了在3.0之前的设备上引用android.R.id.home的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行低于3.0的设备上,是否有一种简单的方法可以引用home按钮?

Is there an easy way to get a reference to the home button on devices running less then 3.0?

我可以执行findViewById(android.R.id.home )在3.0及更高版本上运行,但在较旧的设备上无法正常运行。我不需要监听点击,只需要在其位置上放置另一个视图即可。

I can do findViewById(android.R.id.home) on 3.0 and later but that fails to work on older devices. I don't need to listen for clicks, I just need its location to position another view.

为澄清起见,我指的是该视图: http://developer.android.com/guide/topics/ui/actionbar.html#Home

For clarification I'm referring to this view: http://developer.android.com/guide/topics/ui/actionbar.html#Home

推荐答案

我不知道您在做什么...但是听起来很黑:)

I don't know what you're doing... but it sounds hacky :)

getWindow().getDecorView().findViewById(android.R.id.home)

这篇关于在3.0之前的设备上引用android.R.id.home的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆