【1】如果是tabhost中的activity跳到其他的activity,用这篇blog的方法即可

http://blog.sina.com.cn/s/blog_8db8914301010t31.html

public class AnimCommon {

public static int in = 0;
public static int out = 0;
public static void set(int a, int b){
in = a ;
out = b;
}
public static void clear(){
in = 0;
out = 0;
}
}

下面是tabactivity 类的onPause()
@Override
protected void onPause() {
System.out.println("pause");
if(AnimCommon.in!=0 && AnimCommon.out!=0){
super.overridePendingTransitio
n(AnimCommon.in, AnimCommon.out);
AnimCommon.clear();
}
super.onPause();
}


下面是跳转时的代码:
Intent intent = new Intent(InformActivity.this, InformItemActivity.class);
AnimCommon.set(R.anim.zoom_enter,R.anim.zoom_exit);

startActivity(intent);


这样就可以解决这个问题了。

【2】如果是tabhost里面的两个activity

那么用以下代码

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;
}

tabhost中activity跳转动画不显示的解决办法的更多相关文章

  1. HTML中tr标签设置边框不显示的解决办法

    今天在操作表格的时候发现设置表格中行的边框没有显示,然后自己新建了一个表格发现确实不显示 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tr ...

  2. robot framework 在pycharm中语法无法高亮显示的,显示绿色解决办法(Robot Framework with PyCharm)

    Robot Framework with PyCharm up vote1down votefavorite 1 I am totally new to automation and trying t ...

  3. 【起航计划 004】2015 起航计划 Android APIDemo的魔鬼步伐 03 App->Activity->Animation Activity跳转动画 R.anim.×× overridePendingTransition ActivityOptions类

    App->Activity->Animation示例用于演示不同Activity切换时动态效果. android 5.0例子中定义了6种动画效果: 渐变Fade In 缩放Zoom In ...

  4. (转)Android四大组件——Activity跳转动画、淡出淡入、滑出滑入、自定义退出进入

    文章转自:http://blog.csdn.net/qq_30379689/article/details/52494270 Activity跳转动画.淡入淡出.滑入滑出.自定义退出进入 前言: 系统 ...

  5. 实现activity跳转动画的若干种方式

    第一种: (使用overridePendingTransition方法实现Activity跳转动画) 在Activity中代码如下 /** * 点击按钮实现跳转逻辑 */ button1.setOnC ...

  6. Android四大组件——Activity跳转动画、淡出淡入、滑出滑入、自定义退出进入

    Activity跳转动画.淡入淡出.滑入滑出.自定义退出进入 前言: 系统中有两个定义好的Activity跳转动画:fade_in.fade_out.slide_in_left.slide_out_r ...

  7. python matplotlib plot 数据中的中文无法正常显示的解决办法

    转发自:http://blog.csdn.net/laoyaotask/article/details/22117745?utm_source=tuicool python matplotlib pl ...

  8. ArcGIS客户端API中加载大量数据的几种解决办法

    ArcGIS客户端API中加载大量数据的几种解决办法 2011-03-25 18:17 REST风格的一切事物方兴未艾,ArcGIS Server的客户端API(Javascript/Flex/Sil ...

  9. 5个Android开发中比较常见的内存泄漏问题及解决办法

    android中一个对象已经不需要了,但是其他对象还持有他的引用,导致他不能回收,导致这个对象暂存在内存中,这样内存泄漏就出现了.   内存泄漏出现多了,会是应用占用过多的没存,当占用的内存超过了系统 ...

随机推荐

  1. 给分类(Category)添加属性

    遇到一个问题,写了一个分类,但原先类的属性不够用.添加一个属性,调用的时候崩溃了,说是找不到getter.setter方法.查了下文档发现,OC的分类允许给分类添加属性,但不会自动生成getter.s ...

  2. jQuery easyUI框架中经常出现的问题

    相信开发者对于我们jquery来说都不会陌生吧,jquery为我们的开发提供了很多各式各样的库,满足各种开发的需求,其中我们知道的有轻量级的,但是也有一些基于富客服端的一些重量级库,顾名思义,当我们在 ...

  3. 回退符\b

    回退符\b #include <stdio.h> int main(){ printf("hello\b"); getchar(); getchar(); ; } 实验 ...

  4. Sdut 2151 Phone Numbers (山东省ACM第一届省赛题 A)

    题目描述 We know thatif a phone number A is another phone number B's prefix, B is not able to becalled. ...

  5. 一个在线的C++帮助文档网站 转载

    http://www.cplusplus.com/          //C++参考 http://www.cppreference.com/wiki/start       //C++参考 http ...

  6. 让QMainWindow也表现出QDialog的exec函数的特征

    前几天在做毕业设计项目的时候,使用的PyQt4,想实现这么样一个功能: 场景描述:主窗口a(QMainWindow类型)和主窗口b(QMainWindow),b是通过a窗口中某一个按钮弹出来的. 功能 ...

  7. css3 iphone开关 移动端开关、按钮、input

    css3  iphone开关  移动端开关.按钮.input <!DOCTYPE html> <html> <head> <meta charset=&quo ...

  8. angularjs入门整理

    之前发过一篇博文,从mobile angular ui的demo和其官网初识整个angularjs的大体使用,但是没很好学习,只是通过一些技术博文初步认识,陷入很多坑.所以现在在中文官网正式整理下知识 ...

  9. Delphi 停靠技术的应用

    一.基础知识介绍 1.VCL组件的基础知识 在TWinControl类中有一个DockSite属性(boolean),它的作用是是否允许别的控件停靠在它的上面:在TControl类中有一个DragKi ...

  10. 【python】运算优先级

    来源:小甲鱼 课件