Layout Problems Redux: Hierarchy Viewer

Tips & Tools Layout Problems Redux: Hierarchy Viewer

In the previous Building ‘Droids post, we went through an exercise of figuring out what was going wrong with a RelativeLayout used as rows in a ListView. This exercise used “retro” diagnostic techniques, such as changing background colors, to see what’s going on.

Two commenters, including Romain Guy from the Android team, pointed out the Hierarchy Viewer tool that has been added to the 0.9 SDK. So, today, let’s see what this tool is all about and how it can help you make sense of your layouts as they are used.

To use the Hierarchy Viewer, you first need to fire up your emulator, install your application, launch your activity, and navigate to spot you wish to examine. For today’s demonstration, we’ll use a trivial activity, whose layout is shown below:

[sourcecode language=”xml”]

Guest Blogger
Posts published under this byline have paid for sponsored placement on this website. AndroidGuys does not claim any responsibility for it beyond the pre-approved links and content.