4.13 ViewFlipper切换view,ios:UITabBarController添加图标
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 plain copy print ?
- <**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 plain copy print ?
- <**strong**>
- </**strong**>
2、push_left_out.xml布局文件
[html] view plain copy print ?
- <?**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 = [[UIViewControlleralloc] init];
ctrl2.view.backgroundColor = \[UIColoryellowColor\];
ctrl2.title = @"\#2";
UIViewController本身有个
tabBarItem变量,如果不设置,没有图标,需要图标可以这样设置:
HomeViewController *ctrl1 = [[HomeViewControlleralloc] init];
UITabBarItem \*item = \[\[UITab
写一个自定义的ViewController方便控制,分开来写是一个不错的开发思路,ios果然人性化。
还没有评论,来说两句吧...