设为首页 加入收藏

TOP

Android开发5大布局方式详解(四)
2017-10-13 10:35:47 】 浏览:9827
Tags:Android 开发 布局 方式 详解
  <TextView 
  •         android:text="row two" 
  •         android:textSize="15pt" 
  •         android:background="#DDA0DD" 
  •         android:layout_width="fill_parent" 
  •         android:layout_height="wrap_content" 
  •         android:layout_weight="1" 
  •         /> 
  •       
  •     <TextView 
  •         android:text="row three" 
  •         android:textSize="15pt" 
  •         android:background="#008080" 
  •         android:layout_width="fill_parent" 
  •         android:layout_height="wrap_content" 
  •         android:layout_weight="1" 
  •         />    
  •     <TextView 
  •         android:text="row four" 
  •         android:textSize="15pt" 
  •         android:background="#FFA500" 
  •         android:layout_width="fill_parent" 
  •         android:layout_height="wrap_content" 
  •         android:layout_weight="1" 
  •         />       
  •     </LinearLayout>   
  • </LinearLayout> 
  • 2. 帧布局
    帧布局是从屏幕的左上角(0,0)坐标开始布局,多个组件层叠排列,第一个添加的组件放到最底层,最后添加到框架中的视图显示在最上面。上一层的会覆盖下一层的控件。
     
     简单的例子
    ①效果图:
     
     
    ② 核心代码:
    main.xml
    1. <?xml version="1.0" encoding="utf-8"?> 
    2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    3.     android:layout_width="fill_parent" 
    4.     android:layout_height="fill_parent" 
    5.     > 
    6.     <TextView    
    7.         android:layout_width="300dp"   
    8.         android:layout_height="300dp"   
    9.         android:backgro
    首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/7/7
    】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
    上一篇ListFragment的使用 下一篇Android快乐贪吃蛇游戏实战项目开..

    最新文章

    热门文章

    Hot 文章

    Python

    C 语言

    C++基础

    大数据基础

    linux编程基础

    C/C++面试题目