4.13 ViewFlipper切换view,ios:UITabBarController添加图标
2015-04-13 23:08
417 查看
http://www.2cto.com/kf/201205/131771.html
viewfipper继承关系:
用法:
http://blog.csdn.net/wdaming1986/article/details/6766058
this.flipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_left_in));
this.flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_left_out));
if (count < 3) {
this.flipper.showNext();
count++;
}
this.flipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_right_in));
this.flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_right_out));
if (count > 1) {
this.flipper.showPrevious();
count--;
}
<ViewFlipper android:id="@+id/view_flipper"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:persistentDrawingCache="animation" android:flipInterval="1000"
android:inAnimation="@anim/push_left_in" android:outAnimation="@anim/push_left_out">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/view_bg1" android:src="@drawable/bg1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
</ImageView>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/view_bg2" android:src="@drawable/bg2"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
</ImageView>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/view_bg3" android:src="@drawable/bg3"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
</ImageView>
</LinearLayout>
</ViewFlipper>
anim动画布局文件:
1、push_left_in.xml布局文件:
[html] view
plaincopyprint?
<span style="font-size:13px;"><?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="100%p" android:toXDelta="0"
android:duration="500" />
<alpha android:fromAlpha="0.1" android:toAlpha="1.0"
android:duration="500" />
</set></span>
[html] view
plaincopyprint?
<strong>
</strong>
2、push_left_out.xml布局文件
[html] view
plaincopyprint?
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="-100%p"
android:duration="500" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.1"
android:duration="500" />
</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果然人性化。
viewfipper继承关系:
用法:
http://blog.csdn.net/wdaming1986/article/details/6766058
this.flipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_left_in));
this.flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_left_out));
if (count < 3) {
this.flipper.showNext();
count++;
}
this.flipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_right_in));
this.flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_right_out));
if (count > 1) {
this.flipper.showPrevious();
count--;
}
<ViewFlipper android:id="@+id/view_flipper"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:persistentDrawingCache="animation" android:flipInterval="1000"
android:inAnimation="@anim/push_left_in" android:outAnimation="@anim/push_left_out">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/view_bg1" android:src="@drawable/bg1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
</ImageView>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/view_bg2" android:src="@drawable/bg2"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
</ImageView>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/view_bg3" android:src="@drawable/bg3"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
</ImageView>
</LinearLayout>
</ViewFlipper>
anim动画布局文件:
1、push_left_in.xml布局文件:
[html] view
plaincopyprint?
<span style="font-size:13px;"><?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="100%p" android:toXDelta="0"
android:duration="500" />
<alpha android:fromAlpha="0.1" android:toAlpha="1.0"
android:duration="500" />
</set></span>
[html] view
plaincopyprint?
<strong>
</strong>
2、push_left_out.xml布局文件
[html] view
plaincopyprint?
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="-100%p"
android:duration="500" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.1"
android:duration="500" />
</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果然人性化。
相关文章推荐
- iOS_覆盖uitabbarcontroller全屏的view
- IOS--如何从第N级界面返回到一级界面(即添加在UITabbarController上的UIController)
- iOS开发--ChildViewController实现订单页的切换
- iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
- iOS三种视图切换 (UITabBarController,UINavigationController,模态窗口)
- iOS 视图切换问题 popViewControllerAnimated 视图刷新问题
- ios UIImagePickerController 添加一个自定义的view。
- iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
- iOS ViewController添加Segue
- IOS ViewController切换动画以及如何返回
- IOS学习之第二个View使用UITabBarViewController
- iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
- iOS 7 新特性之ViewController切换
- iOS学习之第二个View使用UITabBarViewController
- ios UITabBarController 切换动画
- iOS 添加Xib文件,并与控制器view controller关联
- iOSalertviewcontroller的action回调对横竖屏切换有影响
- iOS学习之第二个View使用UITabBarViewController
- iOS开发中ViewController切换动画的制作
- 【IOS学习】视图切换,纯代码实现 UITabBarController,NavigationController