如何添加页眉和页脚在Android的每个活动 [英] How to add header and Footer to each activity in android

查看:107
本文介绍了如何添加页眉和页脚在Android的每个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要添加的ImageButton ,一个按钮的TextView 在每个我在顶部和bottom.I活动​​想过用页眉和页脚的。所以我想添加页眉和页脚在每个我的Andr​​oid活动。我没有怎么做到这一点的想法。我不需要怎么写页眉或页脚源$ C ​​$ C。我想知道的是我必须定义页眉和页脚的手段做我需要添加页眉和页脚中的每个XML文件或做我需要定义两个 header.xml footer.xml 并在每个其他XML文件使用这些XML文件。或者是有任何其他方式的意思是想利用这一活动中的java文件的引用。任何帮助鸭preciated。

I want to add a ImageButton, a button and a textview in each of my activity at top and bottom.I thought of using header and footer. So I want to add a header and footer in each of my Android Activity. I don't have any idea of how to do that. I don't need source code of how to write a header or footer. What i want to know is where i have to define that header and footer means do i need to add a header and footer in each xml file or do i need to define two header.xml or footer.xml and use these xml files in each of other xml files. Or is there any other way mean like using a reference from the java file of that activity. Any help Appreciated.

推荐答案

定义两个单独的文件 header.xml footer.xml 键,而且比使用

Define two separate files header.xml and footer.xml and and than use

`<include layout="@layout/header"/>

<include layout="@layout/footer"/>`

这篇关于如何添加页眉和页脚在Android的每个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆