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

6 篇文章 0 订阅

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

viewfipper继承关系:


用法:

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 = [[UIViewController alloc] init];

    ctrl2.view.backgroundColor = [UIColor yellowColor];

    ctrl2.title = @"#2";

UIViewController本身有个

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

HomeViewController *ctrl1 = [[HomeViewController alloc] init];

    UITabBarItem *item = [[UITab

写一个自定义的ViewController方便控制,分开来写是一个不错的开发思路,ios果然人性化。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值