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>

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

  • 相关阅读:
    jsp标签${fn:contains()}遇到问题记录
    maven更改本地的maven私服
    elk使用记录
    dubbo 报错问题记录:may be version or group mismatch
    mybatis自动生成后无法获取主键id问题
    tomcat关闭异常导致的项目无法重启
    jsp 记录
    spring bean
    JDBC
    el表达式
  • 原文地址:https://www.cnblogs.com/0927wyj/p/5312605.html
Copyright © 2011-2022 走看看