以编程方式修改ActionBarDrawerToggle绘制对象 [英] Programmatically Modify ActionBarDrawerToggle Drawable

查看:203
本文介绍了以编程方式修改ActionBarDrawerToggle绘制对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道一种方式来获得由资源ID设置在构造后用于ActionBarDrawerToggle提拉?我使用的是抽屉式导航栏,我想以编程方式应用颜色过滤器的图标,但我无法弄清楚如何访问它作为一个绘制。任何帮助将是AP preciated。谢谢!

Does anyone know a way to get the drawable that is used for the ActionBarDrawerToggle after setting it in the constructor by resource ID? I am using a navigation drawer and I want to apply a color filter to the icon programmatically, but I can't figure out how to access it as a drawable. Any help would be appreciated. Thanks!

推荐答案

由于该框架的ID为视图是隐藏的,我发现访问它的唯一方法是通过在层次结构的基础上,在主页视图的位置走吧。

As the framework's ID for that View is hidden, the only way I've found to access it is by walking through the hierarchy based on the Home View's position in it.

public ImageView getUpView()
{
    ViewGroup parentView = (ViewGroup) findViewById(android.R.id.home).getParent();
    return (ImageView) parentView.getChildAt(0);
}

这篇关于以编程方式修改ActionBarDrawerToggle绘制对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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