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>

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

  • 相关阅读:
    h5混合开发好用的下拉刷新插件
    设置窗体可以使用鼠标拖动大小 通过
    C# 使用System.Data.OleDb;避免oracle中文乱码问题
    C# 开启一个新进程并为新进程设置工作目录
    WPF窗体程序入口 自定义窗体启动页面
    WorkFlow WF如何为一个集合赋值
    第三方框架的使用
    AppIcon应用图标 and Launchimage启动图标的制作
    在didSelectRowAtIndexPath 里面取cell的方法
    iOS 开发技术体系
  • 原文地址:https://www.cnblogs.com/0927wyj/p/5312605.html
Copyright © 2011-2022 走看看