java.lang.Object | ||
↳ | android.app.Fragment | |
↳ | com.htc.fragment.widget.CarouselFragment |
A fragment that contains and runs multiple embedded fragments or views. For having a tab with edit mode, the things you must do are as the following:
super()
with
the authority of your database which contains the information of
every element of your tab as the parameter is required. Also, for supporting
nested tabs, a group ID is required for your fragment in its constructor.
A change to the prototype of CarouselHost.addTab()
is
done for more elegant way of function call. Please refer to the following example
for all the important notices mentioned above:
public class DemoCarousel extends CarouselFragment { public DemoCarousel() { super(MyProvider.AUTHORITY); setGId(0); } public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); CarouselHost host = getCarouselHost(); Context tabContext = getActivity(); host.addTab(tabContext, new CarouselTabSpec("Tab1", R.string.tab1, R.drawable.common_icon_artist_rest , R.drawable.common_icon_artist_on, R.drawable.common_icon_overlay_artist, "com.htc.fragment.app.Tab1")); host.setCountVisibility("Tab1", true); host.setCountText("Tab1", "12"); host.addTab(tabContext, new CarouselTabSpec("Tab2", R.string.tab2, R.drawable.common_icon_albums_rest , R.drawable.common_icon_albums_on, R.drawable.common_icon_overlay_album, "com.htc.fragment.app", "com.htc.fragment.app.Tab2")); ... } }
public class MyProvider extends CarouselProvider { public static final String AUTHORITY = "com.htc.fragment.app.MyProvider"; public MyProvider(){ super(); setupCarousel(AUTHORITY); } }
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CarouselFragment.EditModeListener |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | FEATURE_CUSTOM_TITLE | ||||||||||
int | FEATURE_NO_EDITOR |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the
CarouselHost the activity is using to host its tabs. | |||||||||||
Returns the
CarouselWidget the activity is using to draw the actual tabs. | |||||||||||
Callback function when the current tab is changed
| |||||||||||
A callback function for knowing when the user ends the drag motion
| |||||||||||
A callback function for knowing when the user starts to drag the
tab selector
| |||||||||||
Enables extended screen features.
| |||||||||||
Sets the default tab that is the first tab highlighted.
| |||||||||||
Sets the default tab that is the first tab highlighted.
| |||||||||||
When there are several carousels in your application,
you need to assign each carousel to an unique id.
| |||||||||||
When there are several carousels in your application,
you need to assign each carousel to an unique id.
| |||||||||||
Registers a callback to be invoked when the selected state of any of the items
in this list changes
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructor
authority | The authority of your database which is used to maintain the information of every element of your tab |
---|
Returns the CarouselHost
the activity is using to host its tabs.
CarouselHost
the activity is using to host its tabs.
Returns the CarouselWidget
the activity is using to draw the actual tabs.
CarouselWidget
the activity is using to draw the actual tabs.
Callback function when the current tab is changed
currentTab | The tag of the current tab |
---|
A callback function for knowing when the user ends the drag motion
endTag | The tag of the tab which the user end up dragging the tab indicator |
---|
A callback function for knowing when the user starts to drag the tab selector
startTag | The tag of tab which the users start the dragging |
---|
Enables extended screen features. This must be called before
setContentView(). May be called as many times as desired as long as it
is before setContentView(). If not called, no extended features
will be available. You can not turn off a feature once it is requested.
You canot use other title features with FEATURE_CUSTOM_TITLE
.
featureId | The desired features, defined as constants by Window. |
---|
Sets the default tab that is the first tab highlighted.
tag | The name of the default tab |
---|
Sets the default tab that is the first tab highlighted.
index | The index of the default tab |
---|
When there are several carousels in your application, you need to assign each carousel to an unique id.
gId | Should be unique |
---|
When there are several carousels in your application, you need to assign each carousel to an unique id.
gId | Should be unique |
---|
Registers a callback to be invoked when the selected state of any of the items in this list changes
l | The callback that will run |
---|