42

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 ?

grunk
  • 13,700
  • 12
  • 61
  • 103

10 Answers10

86

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

Bessem Mouelhi
  • 876
  • 7
  • 6
9

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

Jarett Millard
  • 5,275
  • 4
  • 38
  • 48
6

Click on PREVIEW on the right side of the window.

enter image description here

venkatvb
  • 673
  • 1
  • 9
  • 23
Amit Garg
  • 490
  • 4
  • 10
5

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

degratnik
  • 800
  • 2
  • 8
  • 18
2

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).

rupps
  • 9,183
  • 4
  • 53
  • 87
2

Android Studio 2X

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

enter image description here

Igor Wojda
  • 1,739
  • 18
  • 23
2

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

Tobias Reich
  • 4,414
  • 2
  • 42
  • 77
1

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

PrintScreen

Zoe
  • 23,712
  • 16
  • 99
  • 132
3888
  • 11
  • 3
0

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

yoAlex5
  • 13,571
  • 5
  • 105
  • 98
0

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

alex bird
  • 104
  • 4