设为首页 加入收藏

TOP

android TranslateAnimation 顶部segment分段移动动画(一)
2017-10-13 10:36:51 】 浏览:5017
Tags:android TranslateAnimation 顶部 segment 分段 移动 动画

        这里实现的功能是从主页布局的fragment点击跳转到一个acitivity,然后顶部是一个切换的segment底部部是一个listview,点击segment分段让listview加载不同的内容。我这里没再使用viewpager,应该使用viewpager+listview也能实现。我这里使用的算是一个自定义的viewpager。下面我主要围绕TranslateAnimation segment切换动画类来谈,这东西吭比较多,我原本也是才做android开发的, 它这个类实现动画很多效果上的bug,效果bug直接说明android这个动画类没ios做的好,我遇到的这些效果bug主要出现在控件移动的距离和移动时间上的计算上。比如移动动画带有缓冲,或则移动分段两个以上,就没有动画效果。

 

下面先帖上布局,主要就是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
              android:background="@color/white_color"
              android:orientation="vertical" >
    <TextView
        android:layout_width="match_parent"
        android:layout_height="@dimen/navigationbar_height"
        android:textSize="@dimen/title_fontsize"
        android:text="在线视频"

        android:textColor="@color/navigation_title_color"
        android:background="@color/navigationbar_backround_color"
        android:gravity="center"/>
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="53dp"
         android:orientation="vertical"
         android:animateLayoutChanges="true"
         >
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="50dp"
             android:orientation="horizontal"
             >

         <TextView
             android:layout_width="match_parent"
             android:layout_height="@dimen/navigationbar_height"
             android:layout_weight="1"
             android:textSize="@dimen/title_fontsize"
             android:text="推荐"
             android:id="@+id/tuijianVideo"
             android:textColor="@color/hot_price_color"
             android:background="@color/navigationbar_backround_color"
             android:gravity="center"/>
         <TextView
             android:layout_width="match_parent"
             android:layout_height="@dimen/navigationbar_height"
             android:textSize="@dimen/title_fontsize"
             android:layout_weight="1"
             android:text="电影"
             android:id="@+id/dianying"
             android:textColor="@color/navigation_title_color"
             android:background="@color/navigationbar_backround_color"
             android:gravity="center"/>
         <TextView
             android:layout_width="match_parent"
             android:layout_height="@dimen/navigationbar_height"
             android:textSize="@dimen/title_fontsize"
             android:text="电视"
             android:id="@+id/dianshi"
             android:layout_weight="1"
             android:textColor="@color/navigation_title_color"
             android:background="@color/navigationbar_backround_color"
             android:gravity="center"/>
         <TextView
             android:layout_width="match_parent"
             android:layout_height="@dimen/navigationbar_height"
             android:textSize="@dimen/title_fontsize"
             a
首页 上一页 1 2 3 4 下一页 尾页 1/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇广播接收者实现IP拨号 下一篇android 在非UI线程更新UI仍然成..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目