现在的位置: 首页 > 综合 > 正文

Android学习之ViewFlipper

2012年08月16日 ⁄ 综合 ⁄ 共 1347字 ⁄ 字号 评论关闭

大家都知道Tab的用处,其实有时候tab的效果不是很理想,这时候用ViewFlipper也能做到这样的效果,而且更加的炫哦。
ViewFlipper的作用就是可以在一个页面实现多个页面的跳转,并且可以设置动画的效果。还可以手势滑动跳转哦。
通过一个例子来练习下吧。
先来张效果图,很丑的呀...委屈

这里即实现了TAB相应的功能,还具有更多的动画效果,来试试吧....
这个例子主要是采用了android淘宝客户的 方法来实现的...图片也是引用他的。
先说下地步导航的生成吧,直接上代码喽。
其实就个布局文件来生成的e。。
我叫他bottomTab.xml,当然他不是tab啦....

[html] view
plain
copy

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:orientation="vertical" android:layout_width="fill_parent"  
  4.     android:layout_height="wrap_content">  
  5.     <FrameLayout android:layout_width="wrap_content" android:layout_alignParentBottom="true"  
  6.         android:layout_height="wrap_content" >  
  7.   
  8.         <LinearLayout android:orientation="horizontal"  
  9.             android:layout_width="fill_parent" android:layout_height="fill_parent">  
  10.             <ImageView android:id="@+id/imv1" android:layout_width="wrap_content" android:visibility="invisible"  
  11.                 android:layout_height="wrap_content" android:background="@drawable/btn_on" />  
  12.             <ImageView android:id="@+id/imv2" android:layout_width="wrap_content" android:visibility="invisible"  
  13.                 android:layout_height="wrap_content" android:background="@drawable/btn_on" />  
  14.             <ImageView android:id="@+id/imv3" android:layout_width="wrap_content" android:visibility="invisible"

抱歉!评论已关闭.