【问题标题】:Drag and Drop feature is not working in Android Studio. Can't even click to show attributes拖放功能在 Android Studio 中不起作用。甚至不能点击显示属性
【发布时间】:2025-12-11 13:30:01
【问题描述】:

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

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

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

即使我收到“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>

【问题讨论】:

    标签: android-studio android-studio-3.2


    【解决方案1】:

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

    【讨论】:

    • 请添加更多解释和细节,以便其他用户能够很好地理解。