Эй, я только начал использовать Редактор макетов Android Studio, поэтому я только что создал новый проект с основными действиями, так что в середине у него есть текст приветствия. Я следовал всем инструкциям от:
https://developer.android.com/training/basics/firstapp/building-ui
Но у меня ничего похожего нет, у меня просто синий прямоугольник, на котором ничего нет.
Я заметил некоторые ошибки на вкладке «Предупреждение и ошибки»:
1 Rendering Error
Failed to find style 'coordinatorLayoutStyle' in current theme Tip: Try to refresh the layout.
1 Using Private resources:
The resource @string/appbar_scrolling_view_behavior is marked as private in com.android.support:design Private resources should not be referenced; the may not be present everywhere, and even where they are they may disappear without notice. To fix this, copy the resource into your own project instead.
1 Missing Styles:
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
1 Failed to instance one or more classes
The following classes could not be instantiated:
- android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.AppBarLayout (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener Copy stack to clipboard
Понятия не имею, почему это происходит, поскольку я совсем недавно установил Android Studio и не ожидал каких-либо ошибок в новом базовом проекте. Надеюсь, вы можете помочь, спасибо!
EDIT:
XML-ТЕКСТ ПОСЛЕ Я УДАЛИЛ ПРИВЕТСТВЕННЫЙ МИР, ПРОСТО НАКЛОНЯЛ И ПОКРЫЛ РЕДАКТИРОВАТЬ
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
tools:layout_editor_absoluteX="126dp"
tools:layout_editor_absoluteY="158dp" />
</android.support.constraint.ConstraintLayout>
ДРУГОЕ РЕДАКТИРОВАНИЕ: при наведении на EditText (потому что он подчеркнут красным), он говорит, что это представление не ограничено.