我需要Android活动之间的动画.我尝试了一些例子但找不到这样的东西:
解决方法:
导入this项目并在项目属性中标记为库,并将其添加到项目中
像这样创建你的活动:
package com.example.testcube;import androID.app.Activity;import androID.graphics.color;import androID.os.Bundle;import androID.support.v4.vIEw.PagerAdapter;import androID.vIEw.Gravity;import androID.vIEw.VIEw;import androID.vIEw.VIEwGroup;import androID.vIEw.VIEwGroup.LayoutParams;import androID.vIEw.Window;import androID.vIEw.WindowManager;import androID.Widget.TextVIEw;import com.jfeinstein.jazzyvIEwpager.jazzyVIEwPager;import com.jfeinstein.jazzyvIEwpager.jazzyVIEwPager.TransitionEffect;public class MainActivity extends Activity { private jazzyVIEwPager vpage; @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set window fullscreen and remove Title bar, and force landscape orIEntation this.requestwindowFeature(Window.FEATURE_NO_Title); getwindow().setFlags(WindowManager.LayoutParams.FLAG_FulLSCREEN, WindowManager.LayoutParams.FLAG_FulLSCREEN); setContentVIEw(R.layout.activity_main); setupJazziness(TransitionEffect.CubeOut); } private voID setupJazziness(TransitionEffect effect) { vpage = (jazzyVIEwPager) findVIEwByID(R.ID.jazzy_pager); vpage.setTransitionEffect(effect); vpage.setAdapter(new MainAdapter()); vpage.setPagemargin(0); } private class MainAdapter extends PagerAdapter { @OverrIDe public Object instantiateItem(VIEwGroup container, final int position) { TextVIEw text = new TextVIEw(MainActivity.this); text.setGravity(Gravity.CENTER); text.setTextSize(30); text.setTextcolor(color.WHITE); text.setText("Page " + position); text.setpadding(30, 30, 30, 30); int bg = color.rgb((int) Math.floor(Math.random()*128)+64, (int) Math.floor(Math.random()*128)+64, (int) Math.floor(Math.random()*128)+64); text.setBackgroundcolor(bg); container.addVIEw(text, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); vpage.setobjectForposition(text, position); return text; } @OverrIDe public voID destroyItem(VIEwGroup container, int position, Object obj) { container.removeVIEw((VIEw) obj); } @OverrIDe public int getCount() { return 10; } @OverrIDe public boolean isVIEwFromObject(VIEw arg0, Object arg1) { return arg0 == arg1; } }}
在您的活动中,XML应该是
<com.jfeinstein.jazzyvIEwpager.jazzyVIEwPagerxmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:app="http://schemas.androID.com/apk/res-auto"androID:ID="@+ID/jazzy_pager"androID:layout_wIDth="match_parent"androID:layout_height="match_parent" />
总结 以上是内存溢出为你收集整理的Android中的活动之间的3D“立方体”动画全部内容,希望文章能够帮你解决Android中的活动之间的3D“立方体”动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)