zoukankan      html  css  js  c++  java
  • Android布局(3)--帧布局(FrameLayout)

      在帧布局中,每添加一个组件都将创建一个空白区域,通称之为一帧。这些帧都要被对齐到屏幕左上角,不能单独为子组件指定位置。第一个添加到帧布局中的子组件显示在最底层,最后一个添加的子组件位于最顶层,上一层的子组件会覆盖下一层的子组件,这种显示方法类似于堆栈。因此又称为堆栈布局。 

      帧布局的大小由子组件中尺寸最大的子组件来决定。

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.example.demo.FrameLayout">
    
        <TextView
            android:layout_width="300dp"
            android:layout_height="300dp"
            android:id="@+id/textView1"
            android:background="#FFD700"
            android:text="第一行"
            android:gravity="bottom"
            android:textSize="12pt"/>
        <TextView
            android:layout_width="260dp"
            android:layout_height="260dp"
            android:id="@+id/textView2"
            android:background="#FFA07A"
            android:text="第二行"
            android:gravity="bottom"
            android:textSize="14pt"/>
        <TextView
            android:layout_width="220dp"
            android:layout_height="220dp"
            android:id="@+id/textView3"
            android:text="第三行"
            android:background="#FF00FF"
            android:textSize="16pt"/>
        <TextView
            android:layout_width="180dp"
            android:layout_height="180dp"
            android:id="@+id/textView4"
            android:background="#FF0000"
            android:text="第四行"
            android:gravity="bottom"
            android:textSize="16pt"/>
    </FrameLayout>



  • 相关阅读:
    一. web框架-----------ES6语法和VUE介绍(一)
    十.Django---framework框架 响应器(渲染器)
    【hiho1087】Hamiltonian Cycle
    【CF160E】Buses and People
    【51nod1672】区间交
    【洛谷P2915】Mixed Up Cows
    【模板】长链剖分
    【洛谷P4552】IncDec Sequence
    【CF1181C】Flag
    【CF1181D】Irrigation
  • 原文地址:https://www.cnblogs.com/Toring/p/6628293.html
Copyright © 2011-2022 走看看