AndroidStudio,doe not show" hello world"

时间:2018-06-13 07:36:10

标签: android-studio

我刚刚下载了androio工作室,我有2个问题。首先它现在显示了"你好世界"文本,当我尝试按下它时,它显示了这个(这个视图不是约束。它有设计时的位置,所以它会在运行时跳转到(0,0),除非你添加约束)

任何人都可以提供帮助吗?

1 个答案:

答案 0 :(得分:0)

将约束布局转换为相对/线性布局,以便初学者最好从相对/线性布局

开始

复制此内容并替换为activity_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"
    tools:context=".MainActivity">

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

</RelativeLayout>
相关问题