zoukankan      html  css  js  c++  java
  • 安卓开发24:FrameLayout布局

    FrameLayout布局

    FrameLayout是五大布局中最简单的一个布局。FrameLayout布局中的元素会根据先后顺序重叠起来。利用FrameLayout布局元素重叠的特性,我们一般可以做一些层的隐藏和显示,以及在一个图片上放置另外一个小图标等这样的功能。


    看代码:

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
        <!-- 底图 -->
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
    
            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:src="@drawable/test1" />
        </LinearLayout>
    
        <!-- 这个视图会覆盖在上面那个图的上方 -->
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
    
            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="100dp"
                android:layout_marginTop="100dp"
                android:src="@drawable/ic_launcher" />
    
        </LinearLayout>
    
        <!-- 不可见视图 -->
        <ImageView
            android:id="@+id/imageView3"
            android:visibility="gone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/jhs_button1_h4" />
    
    </FrameLayout>


    效果:第一张图在最底下,第二张图在上面,第三张图被gone隐藏了。


  • 相关阅读:
    hdu 2211(约瑟夫环问题)
    hdu 3605(二分图的多重匹配 | 网络流)
    hdu 3360(经典二分匹配)
    hdu 2255(KM)
    ajax无翻页刷新简单实例2
    在Updatepanel中使用Response.Redirect
    asp.net 使用UpdatePanel 返回服务器处理后弹出对话框
    再记一个SQL分页存储过程
    DIV中图片垂直居中
    在Repeter中用RadioButton生成单选按钮组的实现
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3278047.html
Copyright © 2011-2022 走看看