问题
I have been using Android Studio quite a lot in recent weeks, and after a short break I decided to start a new project. Before this point, everything was working fine.
My issue is that the preview is not displayed in text or design. If I run an emulator, my project can be seen.
This is a brand new project, I have yet to type a single line of code.
I have uninstalled android studio and reinstalled it, I have rebuilt the project, I have cleaned the project, I have created new projects, I have installed every SDK available to me, I have invalidated caches/restarted.
I've tried multiple themes. I've tried multiple android versions. I've tried multiple devices.
Can someone please tell me how to fix this?
Screenshot of design view
Screenshot of text view
EDIT
Problem has been fixed by deleting this line of code:
"tools:shownIn="@layout/activity_main"
I have never seen this in a project before... Can anyone shed some light onto why this happened?
回答1:
Welcome to Stackoverflow. Change the following properties as follows. I just had a similar issue and this solved it for me using visual studio
android:layout_width="fill_parent"
android:layout_height="fill_parent"
If this proposed solution does answer your question, please select it as the answer by clicking on the tick mark to the left of this box
回答2:
I had the same issue. I don't see in my .xml file this line of code. But I changed Theme to Material and that solved my case.
The same problem, but other reasons.
Found info here: https://www.quora.com/Design-view-is-not-getting-displayed-in-my-Android-Studio-What-should-I-do
来源:https://stackoverflow.com/questions/36457599/android-studio-preview-not-displaying-version-1-5-1