【发布时间】:2018-08-29 12:58:03
【问题描述】:
我刚刚安装了 Android Studio 并在其中创建了一个项目,但是每当我在其中添加一个 TextView 时,它都没有显示任何内容,即使是由 Android Studio 创建的 TextView 也没有显示
Activity.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="wrap_content"
tools:context=".MainActivity"
tools:layout_editor_absoluteY="25dp">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteX="67dp"
tools:text="Hello World" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
tools:text="sdfsfsfsfs" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Hello World" />
</android.support.constraint.ConstraintLayout>
任何帮助将不胜感激。
【问题讨论】:
-
TextView不受约束,您的根是ConstraintLayout。阅读ConstraintLayout。
标签: android android-layout android-studio