我有4-5个选项卡的TabHost。我想有一个类似的底部所有选项卡。有没有什么办法,我们可以添加一个底部,所有的标签?或者我需要把XML code在每一个布局文件。
I have a TabHost with 4-5 tabs. I want to have a similar bottom for all the tabs. Is there any way we can add a bottom to all the tabs? Or do I need to place the xml code in every layout file.
请让我知道如果任何人有解决方案。
Please let me know if any one has the solution.
问候
苏尼尔
最简单的解决办法是使用<包括>
在布局文件选项
The simplest solution would be to use the <include>
option in your layout files.
定义在布局文件中常见的页脚全部由自己 - 如tab_footer.xml
- 然后其包含到其他布局如下:
Define the common footer in a layout file all by itself - e.g tab_footer.xml
- and then include it into the the other layouts as follows:
<include layout="@layout/tab_footer">
您可以了解更多关于&LT;包括&GT;
中的这个职位上的Android开发者博客。
You can find out more about <include>
in this post on the Android Developers Blog.
这是不是在该帖子中提到一件事:如果你想覆盖任何布局
参数,当您使用&LT;包括&GT;
请确保您覆盖 layout_width
和 layout_height
(即使他们没有改变),否则你的价值观其他参数将被忽略。
One thing that isn't mentioned in that post: if you want to override any layout
parameters when you use <include>
make sure you override layout_width
and layout_height
(even if they're not changing) otherwise your values for other parameters will be silently ignored.