Question

I'm working on pretty complex xml drawable and i was wondering if there is any tool/plugins which allow me to preview my drawable ?

I'm looking for something similar to the "Graphical layout" tab available for layout.

For example if i have something like this :

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:left="0dp" android:right="0dp"> 
        <shape android:shape="rectangle">

            <gradient android:angle="-90" android:startColor="#2B2B2B"
                android:endColor="#000000" />

        </shape>
    </item>
    <item android:top="1sp" android:bottom="26sp" > 
        <shape android:shape="rectangle">
            <solid android:color="#10ffffff"/>
    </shape>

    </item>
</layer-list>

How can i preview the shape and gradient ? And i'm probably dreaming , but is there any graphical tools to build a drawable ?

Was it helpful?

Solution

In Android Studio do this: View -> Tool Windows -> Preview

OTHER TIPS

Android Studio has support for this starting with version 0.3.2: http://tools.android.com/recent/androidstudio032released

Click on PREVIEW on the right side of the window.

enter image description here

In Eclipse Create new layout with root LinearLayout. Open Outline view. In properties table find View.Background. Press button ... Now you can chose Color and Drawable resources and there is small preview.

Preview in Eclipse

Another possibility:

Just create a new layout "test", goto graphical layout, create a button inside (or any view), and assign the drawable to the button's background. The drawable is rendered (its normal state).

Android Studio 2X

  1. View -> Tool Windows -> Preview
  2. Or click on Preview on the right side

enter image description here

Android Studio offers a nice plugin named

"Vector Drawable Thumbnails"

This adds a nice overview over all vector drawables in your project. Just have a look at the side bar and open the view. You will get a thumbnail table of them.

Vector Drawable Thumbnails

One way to preview the resources is by using the Resource Manager in Android Studio. It's visible as a separate tab:

PrintScreen

If you would like to preview selector you can find tabs with states on Preview Panel enter image description here

The Preview options mentioned in previous answers aren't there in Android Studio 4.0. Look for this segmented control in the top-right of the editor tab instead.

Android Studio 4.0.1 showing code/split/design control

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top