为什么布局设计预览未显示在我的Android Studio上?

问题描述:

我不知道是我还是某物,但是我无法在Android Studio的设计模式下放置简单的文本或按钮

I don't know if it's me or something but I can't place a simple text or a button in design mode in Android Studio

如果有帮助,这是代码:

If it helps, this is the code:

<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">

<Button
    android:id="@+id/button2"
    style="@android:style/Widget.Button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="@style/TextAppearance.AppCompat.Button"
    android:visibility="visible"
    app:layout_constraintBottom_toTopOf="parent"
    app:layout_constraintEnd_toStartOf="parent"
    app:layout_constraintHorizontal_bias="0.45"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:text="Test" />

<TextView
    android:id="@+id/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" />

@I_A_Mok

使用.NoActionBar(例如AppCompat.NoActionBar)将编辑器中的主题从应用程序主题更改为任何内容."

这有效!多谢! :D

and this is working! thanks a lot! :D