android - 获取包括操作栏的窗口 View ?

标签 android

如何访问ViewGroup,包括ActionBar但不包括状态栏?

因此,activity.getWindow().getDecorView() 返回给我所有内容,包括状态栏。

但是 activity.findViewById(android.R.id.content) 返回操作栏下方的 View 组。

中间步骤是什么?

最佳答案

如您所知,此 ViewGroup 还将包含状态栏:

findViewById(android.R.id.content).getRootView();

然而,正如我们可以从这个Dumped View Hierarchy 中看到的那样,两者之间没有 ViewGroup:

enter image description here

关于android - 获取包括操作栏的窗口 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25491349/

相关文章:

android - error "Process ' command './node_modules/expokit/detach-scripts/run-exp.sh' ' finished with non-zero exit value 1"whie getting android apk file

android - fragment 中的接口(interface)类有什么用?

空对象引用上的 android.content.Context.getContentResolver()'

java - 如何在另一个 Activity 的 TextView 中调用方法的输出?

android - iq-engines-sdk 错误 : UnsatisfiedLinkError thrown while initializing com/iqengines/sdk/IQLocal

android - Firebase 数据库不提交在线数据阻塞监听器

java - RecyclerView 没有调用 onCreateViewHolder 或 onBindView

c# - OnlyOnRanToCompletion 和 NotOnFaulted 之间的区别?

java - 如何在 Android 应用程序中播放和停止 mp3 文件

android - 一个联系人下的多个号码