4.13 ViewFlipper切换view,ios:UITabBarController添加图标

分手后的思念是犯贱 2022-08-07 13:50 247阅读 0赞

http://www.2cto.com/kf/201205/131771.html

viewfipper继承关系:

20120516103123109.png

用法:

http://blog.csdn.net/wdaming1986/article/details/6766058

  1. this.flipper.setInAnimation(AnimationUtils.loadAnimation(this,
  2. R.anim.push_left_in));
  3. this.flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
  4. R.anim.push_left_out));
  5. if (count < 3) {
  6. this.flipper.showNext();
  7. count++;
  8. }
  1. this.flipper.setInAnimation(AnimationUtils.loadAnimation(this,
  2. R.anim.push_right_in));
  3. this.flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
  4. R.anim.push_right_out));
  5. if (count > 1) {
  6. this.flipper.showPrevious();
  7. count—;
  8. }
  1. <**ViewFlipper** android:id=”@+id/view_flipper”
  2. android:layout_width=”fill_parent” android:layout_height=”fill_parent”
  3. android:persistentDrawingCache=”animation” android:flipInterval=”1000”
  4. android:inAnimation=”@anim/push_left_in” android:outAnimation=”@anim/push_left_out”>
  5. <**LinearLayout** android:orientation=”horizontal”
  6. android:layout_width=”fill_parent” android:layout_height=”fill_parent”>
  7. <**ImageView** android:id=”@+id/view_bg1” android:src=”@drawable/bg1”
  8. android:layout_width=”fill_parent” android:layout_height=”fill_parent”
  9. >
  10. </**ImageView**>
  11. </**LinearLayout**>
  12. <**LinearLayout** android:orientation=”horizontal”
  13. android:layout_width=”fill_parent” android:layout_height=”fill_parent”>
  14. <**ImageView** android:id=”@+id/view_bg2” android:src=”@drawable/bg2”
  15. android:layout_width=”fill_parent” android:layout_height=”fill_parent”
  16. >
  17. </**ImageView**>
  18. </**LinearLayout**>
  19. <**LinearLayout** android:orientation=”horizontal”
  20. android:layout_width=”fill_parent” android:layout_height=”fill_parent”>
  21. <**ImageView** android:id=”@+id/view_bg3” android:src=”@drawable/bg3”
  22. android:layout_width=”fill_parent” android:layout_height=”fill_parent”
  23. >
  24. </**ImageView**>
  25. </**LinearLayout**>
  26. </**ViewFlipper**>

anim动画布局文件:

1、push_left_in.xml布局文件:

[html] view plain copy print ?

  1. <**span style=”font-size:13px;”><?xml version=”1.0” encoding=”utf-8”?>**
  2. <**set xmlns:android=”http://schemas.android.com/apk/res/android“>**
  3. <**translate** android:fromXDelta=”100%p” android:toXDelta=”0”
  4. android:duration=”500” />
  5. <**alpha** android:fromAlpha=”0.1” android:toAlpha=”1.0”
  6. android:duration=”500” />
  7. </**set></span>**

[html] view plain copy print ?

  1. <**strong**>
  2. </**strong**>

2、push_left_out.xml布局文件

[html] view plain copy print ?

  1. <?**xml version=”1.0” encoding=”utf-8”?>**
  2. <**set xmlns:android=”http://schemas.android.com/apk/res/android“>**
  3. <**translate** android:fromXDelta=”0” android:toXDelta=”-100%p”
  4. android:duration=”500” />
  5. <**alpha** android:fromAlpha=”1.0” android:toAlpha=”0.1”
  6. android:duration=”500” />
  7. </**set**>

ios:UITabBarControllert添加图标

UIViewController *ctrl2 = [[UIViewControlleralloc] init];

  1. ctrl2.view.backgroundColor = \[UIColoryellowColor\];
  2. ctrl2.title = @"\#2";

UIViewController本身有个

tabBarItem变量,如果不设置,没有图标,需要图标可以这样设置:

HomeViewController *ctrl1 = [[HomeViewControlleralloc] init];

  1. UITabBarItem \*item = \[\[UITab

写一个自定义的ViewController方便控制,分开来写是一个不错的开发思路,ios果然人性化。

发表评论

表情:
评论列表 (有 0 条评论,247人围观)

还没有评论,来说两句吧...

相关阅读

    相关 bootstrap5 添加图标

    要在 Bootstrap 5 中添加图标,您可以使用 `<i>` 标签并使用带有 `.bi` 类的字体图标库。 例如,要添加一个电话图标,可以使用以下代码: <i

    相关 状态栏添加图标

    关于在状态栏添加类似wifi,蓝牙那样图标,这种需求一般是通过广播来实现的,点击应用UI里的开关发送广播,这个广播由 \\android\\frameworks