TextView在设计预览中显示,但不在实际的Android应用程序中显示

我在第二个Activity中有一个XML布局,根据用户是否登录来显示两个LinearLayouts的一个,而TextView我从来没有在应用中显示文本,但是当我看到布局编辑器中的“设计”面板

TextView在那里(如果我设置背景颜色,它显示颜色),但文本本身从不呈现。

单击MainActivity上的一个按钮将导致启动具有onCreate (它是Kotlin)的LoginActivity

 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.login_layout) 

和布局:

 <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone" android:id="@+id/loggedOut" android:padding="24dp"> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/passName" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:focusable="true" android:hint="Username" android:inputType="textCapCharacters" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/passPin" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:focusable="true" android:hint="PIN" android:inputType="numberPassword" /> </android.support.design.widget.TextInputLayout> <Button android:id="@+id/passSubmit" style="@style/Widget.AppCompat.Button.Colored" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Login" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/loggedIn" android:visibility="visible" android:padding="24dp"> <TextView android:id="@+id/loggedInMessage" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="You're currently logged in" android:textAlignment="center" android:textAppearance="@android:style/TextAppearance.Material.Headline" /> <Button android:id="@+id/passLogout" style="@style/Widget.AppCompat.Button.Colored" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Logout" /> </LinearLayout> </FrameLayout> 

这是Android Studio显示的内容(这些错误是TextInputLayout错误,它表示无法找到隐藏密码图标等) Android Studio向我显示的内容

这就是我的设备显示
我的设备上有什么

编辑:我已经删除了布局文件中除了TextView和一个父LinearLayout一切,它仍然没有显示。

发现问题。 切换android:text="You're currently logged in" android:text="You\'re currently logged in"修复了它。 所以我猜Android在设置XML文本时需要转义单引号?

通过使用布局检查器工具,它显示mText没有价值的发现