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>

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

  • 相关阅读:
    JZYZOJ1311 邮局设置问题 dp
    备忘录和乱七八糟的体会
    Python strip、lstrip和rstrip的用法
    Linux jstack命令详解
    Linux EOF使用
    Linux 千万不要执行的10个命令
    Linux 浅谈Linux 操作系统的安全设置
    linux 使用 ionice 限制 Xen 虚拟机磁盘 IO
    Linux 实现rsyslog日志里面的IP地址记录 未测试
    linux 回收站的添加
  • 原文地址:https://www.cnblogs.com/0927wyj/p/5312605.html
Copyright © 2011-2022 走看看