zoukankan      html  css  js  c++  java
  • Android课程---帧布局 FrameLayout

    帧布局的特点是:

    1.多个组件,层叠显示

    2.所占位置和大小由组件决定

    示例代码:

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="320dp"
            android:height="320dp"
            android:layout_gravity="center"
            android:background="#f00"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="280dp"
            android:height="280dp"
            android:layout_gravity="center"
            android:background="#0f0"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="240dp"
            android:height="240dp"
            android:layout_gravity="center"
            android:background="#00f"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="200dp"
            android:height="200dp"
            android:layout_gravity="center"
            android:background="#ff0"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="160dp"
            android:height="160dp"
            android:layout_gravity="center"
            android:background="#0ff"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="120dp"
            android:height="120dp"
            android:layout_gravity="center"
            android:background="#f0f"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="80dp"
            android:height="80dp"
            android:layout_gravity="center"
            android:background="#000"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:width="40dp"
            android:height="40dp"
            android:layout_gravity="center"
            android:background="#fff"/>
    
    
    
    </FrameLayout>

    由于帧布局是层叠的,所以放了颜色后就能看出来,效果图如下:

  • 相关阅读:
    Go 数组与切片
    Go 常用函数
    Go 函数,包(二)
    函数,包及错误处理
    Go 循环控制
    Go 流程控制
    Go 获取键盘输入,进制转换
    Go 指针,标识符命名规范及关键字
    Go 变量及基本数据类型3
    一文详解微服务架构
  • 原文地址:https://www.cnblogs.com/0927wyj/p/5312605.html
Copyright © 2011-2022 走看看