所以我正在尝试OnActivityResume
使用 Xposed 进行挂钩。这是我在钩子后的代码的一部分:
ArrayList<View> views = new ArrayList<View>();
listViews(views, rootView);
Log.d("ViewListing", Integer.toString(views.size()));
for(Iterator<View> i = views.iterator(); i.hasNext(); ) {
final View item = i.next();
Log.d("ViewListing", "View:" + item.getClass().getName() + ":" + Boolean.toString(item instanceof android.support.v7.widget.Toolbar));
if(item.getClass().getName().equals("android.support.v7.widget.Toolbar")) {
Log.d("ViewListing", "Found Toolbar!");
Drawable d = (Drawable) XposedHelpers.getObjectField(item, "mBackground");
Log.d("ViewListing", "And background?" + d);
}
}
找到工具栏,但可绘制对象是null
. (我的目标是获得背景颜色)