第八周学习报告

本文深入讲解了AndroidStudio中布局的基本概念,包括相对布局和线性布局的使用,以及layout_width和layout_height属性如何决定布局的大小。通过实例代码展示了按钮组件在不同布局策略下的表现。

时间: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"

 

转载于:https://www.cnblogs.com/jhl1234/p/10854057.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值