Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent to DOM inspector for Android Native Layouts?

When developing HTML5 webpages with CSS and javascript, I've found DOM inspectors like Chrome Developer Tools extremely helpful in root causing which CSS styles are being applied to which HTML5 elements on a webpage. The interface allows you to see the actual layout on the left, along with the DOM, with the CSS being applied to the page dynamically at that moment.

My question is - does any tool exist that is similar to this for Android applications? Is there a way to identify which xml styles are being applied to which elements in an activity or application? This would be particularly helpful in seeing the "default" styles.xml in an application.

Does anyone have any suggested tools to help figure out what styles are being applied to each element in an activity?

like image 741
CrimsonX Avatar asked Jun 27 '13 22:06

CrimsonX


2 Answers

Android does not keep the styling information after a View is created. The closest thing you can use is a tool called HierarchyViewer. You can learn more about this tool here: http://developer.android.com/tools/debugging/debugging-ui.html

You should also checkout http://github.com/romainguy/ViewServer to be able to use HierarchyViewer on production devices (we plan on making this requirement obsolete.)

like image 122
Romain Guy Avatar answered Oct 23 '22 23:10

Romain Guy


I have created an app for Android which aspires to be a close match to developer tools known from web browsers. Of course it's only a mere startup and can't match functionality of counterparts designed to inspect web pages, also it can't match what is possible with official desktop tools like the Layout Inspector from the Android Studio.

It has one advantage however, it works offline (directly on the device, no need to use ADB, any SDK etc.).

If you are interested, enjoy the Developer Assistant.

enter image description here

like image 25
Jarosław Wiśniewski Avatar answered Oct 24 '22 00:10

Jarosław Wiśniewski