在Android Studio中,可以使用XML语言编写layout代码。以下是一个基本的layout代码示例:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><TextViewandroid:id="@+id/text_view"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Hello, Android Studio!" /><Buttonandroid:id="@+id/button"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Click Me" /></LinearLayout>在上面的代码中,我们使用LinearLayout作为根视图容器,并设置其宽度和高度为match_parent,表示填充整个屏幕。然后在LinearLayout中添加了一个TextView和一个Button。TextView用于显示文本内容,Button用于点击操作。每个视图组件都有自己的属性,如id、宽度、高度和文本等。可以根据需要在代码中添加更多的视图组件和属性。

