zoukankan      html  css  js  c++  java
  • android FrameLayout

    FrameLayout:帧布局,可以显示图片的动画效果

    前景图像:
    永远处于帧布局最顶的,直接面对用户的图像,,就是不会被覆盖的图片

    常用属性:

    android:foreground:设置该帧布局容器的前景图像

    android:foregroundGravity:设置前景图像显示的位置

    2.实例演示

    1)最简单的例子

    运行效果图:

    23622209

    实现代码如下:

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    
        xmlns:tools="http://schemas.android.com/tools"    
        android:id="@+id/FrameLayout1"    
        android:layout_width="match_parent"    
        android:layout_height="match_parent"    
        tools:context=".MainActivity"     
        android:foreground="@drawable/logo"    
        android:foregroundGravity="right|bottom">    
        
        <TextView    
            android:layout_width="200dp"    
            android:layout_height="200dp"    
            android:background="#FF6143" />    
        <TextView    
            android:layout_width="150dp"    
            android:layout_height="150dp"    
            android:background="#7BFE00" />    
         <TextView    
            android:layout_width="100dp"    
            android:layout_height="100dp"    
            android:background="#FFFF00" />    
            
    </FrameLayout>

    代码解析: 很简单,三个TextView设置不同大小与背景色,依次覆盖,接着右下角的是前景图像,通过 android:foreground="@drawable/logo"设置前景图像的图片, android:foregroundGravity="right|bottom"设置前景图像的位置在右下角

  • 相关阅读:
    List.Foreach与C#的foreach的区别
    他们突然觉得我懂的还挺多,嘎嘎~
    Mysql跨表更新 多表update sql语句总结
    “你没有权限登录JIRA”的解决办法
    iis日志查看
    自已写的Json序列化方法,可以序列话对象的只读属性
    mysql --limit
    python切片
    数据库
    tarzan-linux命令
  • 原文地址:https://www.cnblogs.com/xuqp/p/9790524.html
Copyright © 2011-2022 走看看