Can';在Android Studio预览版和设备上看不到任何内容

Can';在Android Studio预览版和设备上看不到任何内容,android,android-studio,Android,Android Studio,我正在努力学习一个教程,一切都正常。但是,我无法获取视图部分。当我复制xml文件时,它应该显示TextView的占位符文本,但什么也没有发生。我没有收到错误,如果我手动拖动textview,它会出现,但使用match parent不会 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.an

我正在努力学习一个教程,一切都正常。但是,我无法获取视图部分。当我复制xml文件时,它应该显示TextView的占位符文本,但什么也没有发生。我没有收到错误,如果我手动拖动textview,它会出现,但使用match parent不会

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
android:layout_margin="16dp"
tools:context=".MainActivity">


<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent">

    <!-- Contains the list of all sensors, generated in onCreate(). -->
    <TextView
        android:id="@+id/sensor_list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/placeholder_text"
        android:visibility="visible"
        tools:visibility="visible" />
</ScrollView>

我认为匹配的父项没有错 它只是您的约束视图没有关闭标记,添加后将很好地显示

</androidx.constraintlayout.widget.ConstraintLayout>


对不起,我还有结束标签。我只是忘了寄了。该程序运行良好,但当我查看预览时,似乎所有文本视图都位于左下角,如屏幕外。您是否已经尝试在scrollView内部添加布局,如constraintLayout?我使用了线性布局,并添加了所有文本视图的内部,似乎工作正常。非常感谢。