Programmatically Modify ActionBarDrawerToggle Drawable

我的梦境 提交于 2019-12-11 02:33:39

问题


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!


回答1:


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);
}


来源:https://stackoverflow.com/questions/25255768/programmatically-modify-actionbardrawertoggle-drawable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!