How to refresh preview on Android Studio 2.2?
Asked Answered
A

8

51

Now on Android Studio 2.2 on new Preview mode, there are no more refresh button:

enter image description here

  • Image 1: Preview on Android Studio 2.2 (without refresh button)
  • Image 2: Preview on Android Studio 2.1 (with refresh button)

Does anyone know how to display it again? Or with shortcut maybe?

Edit: If I change a drawable by example and that the change does not appear in the layout, the only method that works for me is closed and restart the project. If I close the layout and as I re-opens nothing happens. Same result using the "Synchronized" button.

Acidimetry answered 30/9, 2016 at 7:43 Comment(5)
i thought it was automatically refreshed when you changed something ?Wang
@Wang This is the case for the xml but not for resources (drawable). In this case the refresh button of the preview discards the cache. This is essential.Acidimetry
What worked for me is changing between "design" and "text" tabs. In most of cases the layout was refreshed properly, but I had situations that I had to close layout and open once more. It is very sad that Google throw away this feature. Apparently new Android Studio (2.2.) is still not perfect.Kazue
@Kazue If I change a drawable by example and that the change does not appear in the layout, the only method that works for me is closed and restart the project. If I close the layout and as I re-opens nothing happens. Same result using the "Synchronized" button.Acidimetry
You can't, but there's some workaround. You can remove anything from an XML which will cause it to has an error, A refresh button saying you can try to refresh the view. Just click it other than that, simply you can't.Manche
G
101

Refresh feature is not removed, it is there; It's pretty simple to refresh:

Click on the preview screen to make sure preview window has the focus and press R. It should display the progress in the right-top corner while refreshing.

If it doesn't work for any reason, switch to design tab and press R, it refreshes the layout instantly.

Greeson answered 6/2, 2017 at 1:35 Comment(1)
Thx, Confirmed it works. (even if I didn't notice the progress bar...)Trabeated
A
22

I think it is a small bug. But I find a hack solution to resolve the problem, you can modify the a resource id to a wrong name, for example, you have a resource named 'ic_launcher', when you input 'ic_launcher1', you can find the interface like that:

enter image description here

next step, click refresh icon(sometimes it is 'clear cache' label). it is works for me.

I have try to change the orientation, but it not works when I replace a exist image file.

May your problem is same as : https://mcmap.net/q/354554/-android-studio-2-2-layout-editor-refresh-button

Aerodontia answered 8/10, 2016 at 5:22 Comment(1)
And i mentioned it brother @ MarsPeopleAerodontia
Y
10

Display again?

I guess you cant. Apparently the refresh functionality has been removed because they think the processing will happen much faster and will auto-refresh the previews real time. The Layout Editor's document has no mention of refresh functionality.

Shortcut?

If you are faster in making changes to your layout than Android-studio refreshes, you could try toggling between the design and blueprint views using the shortcut B

Refer the Layout Editor Official Documentation for other shortcuts you might feel comfortable with or works for you.

Yuki answered 3/10, 2016 at 7:43 Comment(1)
Of all the buttons Google could have removed they chose the Refresh button!? What is this nonsense >.<Zillion
T
5

So do the Simple Step. When you change your layout then save it and clean your project. go to menu Build -> Clean Project.

I Hope this will help you.

Tybalt answered 6/10, 2016 at 10:23 Comment(0)
I
3

There is no refresh button in stable version of android studio 2.2 for preview. But there is a work around to do so. By toggling the orientation button in an editor will refreshes the changes!

Irma answered 4/10, 2016 at 6:39 Comment(0)
C
2

I too had the same Problem , sometimes changing the Android Version worked and it'll sure work if you clean/Rebuild the project

Communication answered 3/10, 2016 at 16:57 Comment(0)
B
1

The new Android Studio Electric Eeel 2022.1.1 has this refresh option

Here

Brickle answered 23/5, 2023 at 13:4 Comment(0)
M
0

Find the double diagonal lines below your preview layout and click them. It will refresh your layout.

Double Diagonal Line

Movie answered 7/10, 2016 at 1:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.