Android的:如何设置tabhost的标签在两行? [英] android: how to set tabs of tabhost in two lines?
本文介绍了Android的:如何设置tabhost的标签在两行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我想设置喜欢这种风格的标签控件:
Now I want to set the tab widget like this style:
我应该怎么办?我所知道的可能性是修改Android源$ C $ C,任何更好的想法?非常感谢!
how should I do? All I know the possibility is to modify the Android source code, Any better ideas? Thanks a lot!
推荐答案
我用片段来执行招:请参阅的 Android的文件。所以,你应该在什么都布局和通过点击其中的一个展示4种不同的片段添加例如4个按钮,下面是显示一个片段样本:
I use Fragment to perform the trick: Please see the Android's Doc. So you should add for example 4 buttons in what ever layout and show 4 different Fragment by click one of them, below is the sample to show one Fragment:
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag(TAG_APP_DIALOG);
if (prev != null) {
ft.remove(prev);
}
// Create and show the dialog fragment.
DialogFragment newFragment = AppDialogFragment.newInstance(folderName, this, appInfos);
newFragment.setRetainInstance(false);
ft.add(mRootLayout.getId(), newFragment, TAG_APP_DIALOG);
ft.commit();
这篇关于Android的:如何设置tabhost的标签在两行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文