Recent Changes‎ > ‎

Custom views in the palette

posted Apr 4, 2011, 10:03 AM by Tor Norbye
Any custom views in your project (or in libraries that your project depends on) should now show up in the new "Custom Views" category in the palette:
ADT searches your project and jar files for classes that extend android.view.View, and lists these in the palette. From there you can drag them into the canvas, and the normal drag preview should work as well.

Tip: In your custom view class, call isInEditMode() (which is inherited from android.view.View) to determine if your view is being created and painted from within a tool rather than really running on a device or emulator. You can use this to avoid doing work which doesn't work when the application isn't really running, such as creating threads or looking up values in a database.

Comments