0

我想将元素拖放到设计视图中,但我不能。当单击屏幕或显示“Hello World!”的默认 TextView 时,我什至看不到属性。我尝试重新启动 Android Studio,重建项目,但问题仍然存在。

下面的代码来自我的文件“activity_main.xml”。

是怎么发生的?我只是尝试在屏幕设计中添加一个“GridLayout”,但要使用它,我必须安装一个库来使用该网格布局,因为我这样做了,所以我不能再使用设计视图了。

即使我收到“IDE 致命错误”(截图如下)。

错误ide图片:
错误 ide 图像

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>
4

1 回答 1

0

从你的 build.gradle (app) 中删除实现 'com.android.support.constraint:constraint-layout:+' 希望能解决这个问题

于 2019-04-14T08:09:23.520 回答