Ali Bdeir
Ali Bdeir

Reputation: 4375

How to refresh a resource in Android Studio without restarting?

I'm working on resizing and changing background images. However, each time I have to restart Android Studio so the Layout Preview will refresh the image.

Doesn't work:

What else can I do?

On Android Studio 2.2.2, Windows 10 64-bit on AMD A8-6410 with AMD Radeon R5 Graphics, 11 GB of RAM.

Upvotes: 5

Views: 4816

Answers (1)

Ali Bdeir
Ali Bdeir

Reputation: 4375

If you're on pre-Android Studio 2.2: just hit the refresh button on the menu bar of the layout editor.

Otherwise:

Go to the layout you're working on. Then, change any resource to an incorrect name.

For example, if you have a button with this attribute:

android:background="@drawable/button"

Replace it with any random false resource:

android:background="@drawable/thisIsSomethingVeryRandomAndDoesntExist"

Then, you'll get something similar to this:

image

Click the "Refresh" (Sometimes "Clear Cache"), then go and undo the changes you did with the attribute. Voila!

Sometimes even changing the orientation works.

Source

Upvotes: 3

Related Questions