質問

I have the following tutorials on creating tabs in Android. It is found here and here.

The first one uses FragmentTabHost and the second one uses TabHost in creating the tab with the use of fragments. I have a difficulty in trying to identify its difference and implication on its performance.

I tried to search but failed to find the answer. Can anyone help me here? Thanks.

役に立ちましたか?

解決

I have a difficulty in trying to identify its difference and implication on its performance.

As it's name suggest a FragmentTabHost is a special case of TabHost specifically built to handle tab fragments. As you can see from the official guide it's quite easy to use the FragmentTabHost with fragments, compare this to the tutorial that you linked to and you'll see the(quite big) difference(which makes it easier to make errors).

There isn't a performance difference other than a performance problem introduced by working with the fragments themselves(which shouldn't happen if they are built right).

It's kind of the same difference between an Activity and a ListActivity, one(the ListActivity) makes it easier to work in a specific scenario(content using a ListView) through some convenience methods(getListView(), getListAdapter() etc).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top