当前位置: 首页>>代码示例>>Java>>正文


Java ViewAnimator.getDisplayedChild方法代码示例

本文整理汇总了Java中android.widget.ViewAnimator.getDisplayedChild方法的典型用法代码示例。如果您正苦于以下问题:Java ViewAnimator.getDisplayedChild方法的具体用法?Java ViewAnimator.getDisplayedChild怎么用?Java ViewAnimator.getDisplayedChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ViewAnimator的用法示例。


在下文中一共展示了ViewAnimator.getDisplayedChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flipTransition

import android.widget.ViewAnimator; //导入方法依赖的package包/类
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will
 * initiate a {@link FlipAnimation} to show the next View.
 * If the currently visible view is the last view, flip direction will be reversed for this
 * transition.
 *
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir the direction of flip
 * @param duration the transition duration in milliseconds
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir,
                                  long duration) {

    final View fromView = viewAnimator.getCurrentView();
    final int currentIndex = viewAnimator.getDisplayedChild();
    final int nextIndex = (currentIndex + 1) % viewAnimator.getChildCount();

    final View toView = viewAnimator.getChildAt(nextIndex);

    Animation[] animc = AnimationFactory.flipAnimation(fromView, toView,
            (nextIndex < currentIndex ? dir.theOtherDirection() : dir), duration, null);

    viewAnimator.setOutAnimation(animc[0]);
    viewAnimator.setInAnimation(animc[1]);

    viewAnimator.showNext();
}
 
开发者ID:whereuat,项目名称:whereuat-android,代码行数:28,代码来源:AnimationFactory.java

示例2: flipTransition

import android.widget.ViewAnimator; //导入方法依赖的package包/类
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call 
 * to this method will initiate a {@link FlipAnimation} to show the next 
 * View. If the currently visible view is the last view, flip direction 
 * will be reversed for this transition.
 *  
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir the direction of flip
 * @param duration the transition duration in milliseconds
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir, long duration) {   
	
	final View fromView = viewAnimator.getCurrentView();
	final int currentIndex = viewAnimator.getDisplayedChild();
	final int nextIndex = (currentIndex + 1)%viewAnimator.getChildCount();
	
	final View toView = viewAnimator.getChildAt(nextIndex);		
			
	if(android.os.Build.VERSION.SDK_INT>=12) {
		//New way of flipping.
		flipTransition(fromView, toView);
	}else{
		//Traditional flip.
		Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, 
				(nextIndex < currentIndex?dir.theOtherDirection():dir), duration, null);
		viewAnimator.setOutAnimation(animc[0]);
		viewAnimator.setInAnimation(animc[1]);
		viewAnimator.showNext();
	}	   
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:31,代码来源:AnimationFactory.java

示例3: setDisplayedChild

import android.widget.ViewAnimator; //导入方法依赖的package包/类
@BindingAdapter("displayedChild")
public static void setDisplayedChild(@NonNull final ViewAnimator viewAnimator,
        final int child) {
    if (viewAnimator.getDisplayedChild() != child) {
        viewAnimator.setDisplayedChild(child);
    }
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:8,代码来源:BindingAdapters.java

示例4: show

import android.widget.ViewAnimator; //导入方法依赖的package包/类
@UiThread
public void show(@IdRes int viewId) {
    ViewAnimator animator = (ViewAnimator) sceneView.findViewById(animatorId);
    View view = sceneView.findViewById(viewId);

    if (animator.getDisplayedChild() != animator.indexOfChild(view)) {
        animator.setDisplayedChild(animator.indexOfChild(view));
    }
}
 
开发者ID:hawkular,项目名称:hawkular-android-client,代码行数:10,代码来源:ViewDirector.java

示例5: tryFlipToPreviousView

import android.widget.ViewAnimator; //导入方法依赖的package包/类
public static boolean tryFlipToPreviousView(final ViewAnimator viewAnimator) {
    if (viewAnimator == null || viewAnimator.getDisplayedChild() == 0) return false;

    viewAnimator.showPrevious();
    return true;
}
 
开发者ID:danrien,项目名称:projectBlue,代码行数:7,代码来源:LongClickViewAnimatorListener.java

示例6: onViewChanged

import android.widget.ViewAnimator; //导入方法依赖的package包/类
@Override
public void onViewChanged(ViewAnimator viewAnimator) {

    if (viewAnimator.getDisplayedChild() > 0) {
        if (numberOfMenusShown == 0 && onAnyMenuShown != null) onAnyMenuShown.onAnyMenuShown();

        ++numberOfMenusShown;

        if (shownMenu != null)
            LongClickViewAnimatorListener.tryFlipToPreviousView(shownMenu);

        shownMenu = viewAnimator;
    } else {

        if (shownMenu == viewAnimator) shownMenu = null;

        if (--numberOfMenusShown == 0 && onAllMenusHidden != null) onAllMenusHidden.onAllMenusHidden();
    }

    if (onViewChangedListener != null)
        onViewChangedListener.onViewChanged(viewAnimator);
}
 
开发者ID:danrien,项目名称:projectBlue,代码行数:23,代码来源:ViewChangedHandler.java

示例7: flipTransition

import android.widget.ViewAnimator; //导入方法依赖的package包/类
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.  
 * If the currently visible view is the last view, flip direction will be reversed for this transition.
 *  
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir the direction of flip
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir) {   
	
	final View fromView = viewAnimator.getCurrentView();
	final int currentIndex = viewAnimator.getDisplayedChild();
	final int nextIndex = (currentIndex + 1)%viewAnimator.getChildCount();
	
	final View toView = viewAnimator.getChildAt(nextIndex);

	Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, (nextIndex < currentIndex?dir.theOtherDirection():dir), 500, null);
 
	viewAnimator.setOutAnimation(animc[0]);
	viewAnimator.setInAnimation(animc[1]);
	
	viewAnimator.showNext();   
}
 
开发者ID:adiguzel,项目名称:wordwise,代码行数:23,代码来源:AnimationFactory.java

示例8: flipTransition

import android.widget.ViewAnimator; //导入方法依赖的package包/类
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.  
 * If the currently visible view is the last view, flip direction will be reversed for this transition.
 *  
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir the direction of flip
 * @param duration the transition duration in milliseconds
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir, long duration) {   
	
	final View fromView = viewAnimator.getCurrentView();
	final int currentIndex = viewAnimator.getDisplayedChild();
	final int nextIndex = (currentIndex + 1)%viewAnimator.getChildCount();
	
	final View toView = viewAnimator.getChildAt(nextIndex);

	Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, (nextIndex < currentIndex?dir.theOtherDirection():dir), duration, null);
 
	viewAnimator.setOutAnimation(animc[0]);
	viewAnimator.setInAnimation(animc[1]);
	
	viewAnimator.showNext();   
}
 
开发者ID:Vosie,项目名称:WikiCards,代码行数:24,代码来源:AnimationFactory.java

示例9: flipTransition

import android.widget.ViewAnimator; //导入方法依赖的package包/类
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.
 * If the currently visible view is the last view, flip direction will be reversed for this transition.
 *
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir          the direction of flip
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir) {

    final View fromView = viewAnimator.getCurrentView();
    final int currentIndex = viewAnimator.getDisplayedChild();
    final int nextIndex = (currentIndex + 1) % viewAnimator.getChildCount();

    final View toView = viewAnimator.getChildAt(nextIndex);

    Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, (nextIndex < currentIndex ? dir.theOtherDirection() : dir), 500, null);

    viewAnimator.setOutAnimation(animc[0]);
    viewAnimator.setInAnimation(animc[1]);

    viewAnimator.showNext();
}
 
开发者ID:RandoApp,项目名称:Rando-android,代码行数:23,代码来源:AnimationFactory.java

示例10: fadeTransition

import android.widget.ViewAnimator; //导入方法依赖的package包/类
/**
 * Fades out the current view to the next view of the {@code ViewAnimator}'s subviews with a fade in
 * effect. If the currently visible view is the last view, fade will restore the front view.
 * 
 * @param viewAnimator
 * @param fadeOutDuration
 * @param fadeInDuration
 */
public static void fadeTransition(final ViewAnimator viewAnimator, long fadeOutDuration, long fadeInDuration) {

	final View fromView = viewAnimator.getCurrentView();
	final int currentIndex = viewAnimator.getDisplayedChild();
	final int nextIndex = (currentIndex + 1) % viewAnimator.getChildCount();

	final View toView = viewAnimator.getChildAt(nextIndex);
	
	Animation[] animc = fadeTransition(fromView, toView, fadeOutDuration, fadeInDuration);
	
	viewAnimator.setOutAnimation(animc[0]);
	viewAnimator.setInAnimation(animc[1]);
	viewAnimator.showNext();
	
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:24,代码来源:AnimationFactory.java


注:本文中的android.widget.ViewAnimator.getDisplayedChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。