Android Question TabHost and StdViewPager doubts

Jerez

Active Member
Licensed User
Longtime User
Hi:

I have 3 questions:

I need to load about 10 pages (and maybe more) in a TabHost or StdViewPager.

1) Can i change the current tab calling it by name and not by index?
2) When a tab is changed can i apply a slide animation? (like StdViewPager)
3) Can i load in a StdViewPager 10 panels but only show upto 5 (touch scroll) and the others call it by code?

thanks!
 

Jerez

Active Member
Licensed User
Longtime User

Thanks Erel.
 
Upvote 0

Jerez

Active Member
Licensed User
Longtime User
Maybe this code found in Stackoverflow can help to have a TabHost with transition animation? any way to wrap to use it?

http://stackoverflow.com/questions/10009155/android-tabactivity-with-transition-animation

B4X:
getTabHost().setOnTabChangedListener(new OnTabChangeListener() {
     public void onTabChanged(String tabId)
     {
            View currentView = getTabHost().getCurrentView();
            if (getTabHost().getCurrentTab() > currentTab)
            {
                currentView.setAnimation( inFromRightAnimation() );
            }
            else
            {
                currentView.setAnimation( outToRightAnimation() );
            }

            currentTab = getTabHost().getCurrentTab();
     }
});

B4X:
public Animation inFromRightAnimation()
{
    Animation inFromRight = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT, +1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromRight.setDuration(240);
    inFromRight.setInterpolator(new AccelerateInterpolator());
    return inFromRight;
}

public Animation outToRightAnimation()
{
    Animation outtoLeft = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT, -1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoLeft.setDuration(240);
    outtoLeft.setInterpolator(new AccelerateInterpolator());
    return outtoLeft;
}
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…