布局嵌套其他布局(比如说每个页面的顶部都有同样的控件,那就不要一一去添加,采用此方法)
来源:互联网 发布:四川麻将源码下载 编辑:程序博客网 时间:2024/06/05 21:54
最近压力比较大,学习进度加快,知识接收并没有那么快了。
这个知识点貌似以前有用过,不过现在连印象都没有,真是悲催啊!
废话不多说,直接切入正题吧:
使用方式:
(1)比如说每个页面中的顶部都出现一样的多个控件,为了方便/节省时间/代码优化,那么就把此布局顶布局好了,其他布局只要嵌套使用就可以了:
activity_top.xml中的代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bb" >
<ImageView
android:id="@+id/ivAll"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/mem_bar_bg"/>
<ImageButton
android:id="@+id/ibAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/mem_bar_bg"
android:src="@drawable/btn_homeasup_default"
android:clickable="true"/>
<TextView
android:id="@+id/tvAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textSize="@dimen/mainsize"/>
</RelativeLayout>
(2)其他布局使用上面的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include layout="@layout/activity_top"/>
<!--使用格式 -->
</RelativeLayout>
- 布局嵌套其他布局(比如说每个页面的顶部都有同样的控件,那就不要一一去添加,采用此方法)
- PullToRefreshScrollView 嵌套gridview或listView,顶部布局顶上去的问题处理
- ListView的每个Item都不同布局
- Android中很多界面的顶部都有相同类似的布局,我们怎么设置呢?
- 动态创建相对布局和 其他控件 ,添加布局属性和相对的对齐属性
- 同样的布局,在4 5上没问题,但是5s 6 6s 6p都有问题
- 打开套有 ListVew的 ScrollView的页面布局 默认 起始位置不是最顶部
- 三十三、Java图形化界面设计——布局管理器之null布局(空布局)一般容器都有默认布局方式,但是有时候需要精确指定各个组建的大小和位置,就需要用到空布局。 操作方法: 1)
- 页面的五种布局以及嵌套
- 终端服务中让每个用户都有同样的输入法配置
- web页面布局的方法
- 页面布局的多种方法
- ScrollView嵌套其他布局时不能达到全屏的效果
- Android一个布局文件嵌套另一个布局文件的方法
- 一个顶部有按钮的list列表布局xml文件
- 【web布局】点击按钮返回页面顶部的功能实现
- Android 布局文件中使用其他布局文件的方法
- 布局的嵌套
- 创建和导出SVG的技巧
- poj 3186 Treats for the Cows 动态规划
- 正则表达式\b
- PHP中==和===的区别
- Android高德地图API配置
- 布局嵌套其他布局(比如说每个页面的顶部都有同样的控件,那就不要一一去添加,采用此方法)
- linux系统下(x86_64)安装jdk 1.6(jdk-6u45-linux-x64.bin)
- Linux SPI总线和设备驱动架构之一:系统概述
- VMware Fusion 8 Pro
- hdu 3949 XOR
- Fragment用法
- 构造方法
- java语言 flatten(Object[] objs){} 方法
- 【最小表示法】HDU4162Shape Number