zoukankan      html  css  js  c++  java
  • Android中FrameLayout总结

    今天在学习实现墨迹天气那样的拖动效果时,看到用的是重写FrameLayout

    FrameLayout布局是最简单的布局方式,所有添加到这个布局中的视图都是以层叠的方式显示。第一个添加到布局中视图显示在最底层,最后一个被放在最顶层。上一层的视图会覆盖下一层的视图,因此该布局类似于堆栈布局。注意点:a.默认对其方式是左上角对齐。b.若要设置子视图的位置,要设置layout_gravity属性值。

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <FrameLayout
     3     xmlns:android="http://schemas.android.com/apk/res/android"
     4     android:layout_width="fill_parent"
     5     android:layout_height="fill_parent"
     6     android:background="#897753"
     7     >
     8     <ImageView 
     9         android:id="@+id/image1"
    10         android:layout_width="fill_parent"
    11         android:layout_height="fill_parent"
    12         android:visibility="invisible"
    13         android:src="@drawable/sky"/>
    14     <ImageView 
    15         android:id="@+id/image2"
    16         android:visibility="invisible"
    17         android:layout_width="fill_parent"
    18         android:layout_height="fill_parent"
    19         android:src="@drawable/cloud"/>
    20     <ImageView 
    21         android:id="@+id/image3"
    22         android:visibility="invisible"
    23         android:layout_width="fill_parent"
    24         android:layout_height="fill_parent"
    25         android:src="@drawable/sun"/>
    26 
    27 </FrameLayout>

    其中,image1、image2、image3都是在同一块空间的。可以说它们是重叠着的,界面显示的是最近用的那一个。

  • 相关阅读:
    按顺序触发事件LazyMan deepcopy
    requirejs学习,demo下载学习
    滑动删除demo
    jquery1.7.2的源码分析(四)$.Deferred(2)
    jquery1.7.2的源码分析(三)$.Deferred
    jquery1.7.2的源码分析(二)
    jquery1.7.2的源码分析(一)
    解码H264文件的一些基础知识
    和 的区别
    Jmeter Cookie管理器 获取JSESSIONID
  • 原文地址:https://www.cnblogs.com/baorantHome/p/5853263.html
Copyright © 2011-2022 走看看