Android studio的欢迎界面突然不再显示

Android studio的欢迎界面本来还有,今天运行时没有了
页面布局和逻辑代码也都在

图片说明

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 帮你找了个相似的问题, 你可以看下: https://ask.csdn.net/questions/748155
  • 我还给你找了一篇非常好的博客,你可以看看是否有帮助,链接:Android Studio 可视化界面编辑器无法显示界面问题的终极解决方案
  • 除此之外, 这篇博客: Android studio 编写一个登录页面,并且具有注册功能中的 3.欢迎界面——Welcome.java 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:
    package com.example.test06;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.SharedPreferences;
    import android.os.Bundle;
    import android.widget.TextView;
    
    public class Welcome extends AppCompatActivity {
        SharedPreferences sp;
        TextView showhello;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_welcome);
            sp = this.getSharedPreferences("username", this.MODE_PRIVATE);  //获取sharepreferences
            showhello = this.findViewById(R.id.mainword);           //显示欢迎
    
            showhello.setText("欢迎你!"+sp.getString("Loginname",""));     //获取用户名
        }
    }
    

    这是对应的布局文件activity_welcome.xml

    <?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"
        tools:context=".Welcome">
        <TextView
            android:id="@+id/mainword"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:gravity="center"
            android:textSize="22dp"
            tools:ignore="MissingConstraints" />
    </androidx.constraintlayout.widget.ConstraintLayout>
    

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^