多个片段具有相同的布局 [英] Multiple Fragments with same layout
问题描述
我应该怎么做才能让多个片段具有相同的布局。我刚刚建立,但不能单独访问部件。我想这是因为它们具有相同的ID。我们怎样才能重用布局文件?
What should I do to make Multiple Fragments with the same layout. I've just created it but can't access widgets separately. I think it's because they have the same ids. How can we reuse the layout file?
例如:
每个客户端重新presents一个标签
example: Each client represents a tab
[ - 名称 - ] [ - 名称 - ] [ - 姓名 - ]
[--Name--][--Name--][--Name--]
客户端1,2,3使用相同的布局。我们如何可以重用的布局?
Client 1,2,3 use the same layout. How can we reuse the layout ?
推荐答案
那么,它很容易简单,只要用片段状态寻呼机适配器
的http://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html
Well, it's easy as simple as using fragment state pager adapter http://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html
有一吨的例子在那里
这篇关于多个片段具有相同的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!