Android Studio显示文字

首先创建一个新的Android项目,步骤如下:

选择Empty Activity。

点击next,命名项目名称为a,点击finish生成应用程序框架。

修改页面布局文件activity_main.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=".MainActivity">

    <TextView                    
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="开始学习吧!!!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

 修改后点击工具栏上的运行按钮

 运行结果如下

 

 


版权声明:本文为m0_61132711原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。