0
我試圖添加動畫時,選項卡更改,我有一個列表視圖作爲我的選項卡,現在我有動畫工作。使用這種TabHost動畫與更改選項卡
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();
}
});
這
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;
}
基於以下後
:
Android - TabActivity with Transition animation
但隨着我的名單來看,我有它一個頭,和我想要的頭留下來,只是列表更改,我怎麼能改變這個?