时间:4h
代码行:200
这周统一按照视频学习android studio,学习了布局,比如相对布局和线性布局。
layout_width
layout_height,这两个属性就决定了布局的宽度和高度
wrap_content 刚刚把文字组件包裹满的长度
match_parent 撑满整个父空间的长度
100px 具体的像素值
基础相对布局实验代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"
/>
<Button
android:id="@+id/button_2"
android:layout_below="@id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 2"
/>
</RelativeLayout>
中间设置为: android:gravity="center"