Android Studio基本活动显示为空白

时间:2018-08-22 02:25:02

标签: java android android-layout android-studio layout

请大家我目前正在做一个项目,但是每次我尝试实现android基本活动时,它显示为空白,有人可以帮助我做什么。谢谢

1 个答案:

答案 0 :(得分:1)

尝试按照以下代码替换您的content_main.xml文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".MainActivity"
    tools:showIn="@layout/activity_main">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />

</RelativeLayout>