设为首页 加入收藏

TOP

android TranslateAnimation 顶部segment分段移动动画(二)
2017-10-13 10:36:51 】 浏览:5021
Tags:android TranslateAnimation 顶部 segment 分段 移动 动画
ndroid:text
="动漫" android:layout_weight="1" android:id="@+id/dongman" 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/zongyi" android:layout_weight="1" android:textColor="@color/navigation_title_color" android:background="@color/navigationbar_backround_color" android:gravity="center"/> </LinearLayout> <ImageView android:layout_width="match_parent" android:id="@+id/Imagezhishiqi" android:layout_height="3dp" android:background="@color/hot_price_color"/> </LinearLayout> <com.lt.WBTaoBaoKe.custom.xPullRefresh.XListView android:id="@+id/xListView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:cacheColorHint="#00000000"> </com.lt.WBTaoBaoKe.custom.xPullRefresh.XListView> </LinearLayout> View Code

下面贴代码,有动画说明的详细注视

public class HomeFragment_VideoActivity extends Activity implements View.OnClickListener {

    private ListViewAdapter listViewAdapter;
    private ViewPagerAdapter viewPagerAdapter;
    private Context context;
    private LinearLayout.LayoutParams zhishiqilinearParams;
    private int zhishiqiWidth;
    private ImageView zhishiqi;
    private TextView tuijianView;
    private TextView dianying;
    private TextView dianshi;
    private TextView dongman;
    private TextView zongyi;
    private int currentTopItemIndex;
    private TranslateAnimation moveAnimation;
    private int moveStepValue;

    //视频数据
    private XListView listView;
    private JSONArray CurrentVideoDataArray;
    private int currentVideoPageIndex;
    private String refreshTime = "第一次刷新";
    private ViewGroup.MarginLayoutParams margin;

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = getApplicationContext();
        setContentView(R.layout.home_video_activity);
        //指示器
        zhishiqi = (ImageView) findViewById(R.id.Imagezhishiqi);
        currentTopItemIndex = 1;
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
        //由于我们分段是固定的5段,所以这里先使用手机屏幕宽度/5,计算出分段指示器的宽度
        zhishiqiWidth = width / 5;
        //由于在固定布局中无法准确设置出指示器的宽度,所以这里需要使用计算出的宽度重新设置指示器宽度
        zhishiqilinearParams = (LinearLayout.LayoutParams) zhishiqi.getLayoutParams();
        zhishiqilinearParams.width = zhishiqiWidth;
        zhishiqi.setLayoutParams(zhishiqilinearParams);
        //下面都是每个分段里面显示文字的textview控件
        tuijianView = (TextView) findViewById(R.id.tuijianVideo);
        dianying = (TextView) findViewById(R.id.dianying);
        dianshi = (TextView) findViewById(R.id.dianshi);
        dongman = (TextView) findViewById(R.id.dongman);
        zongyi = (TextView) findViewById(R.id.zongyi);

        tuijianView.setTag(1);
        dianying.setTag(2);
        dianshi.setTag(3);
        dongman.setTag(
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇广播接收者实现IP拨号 下一篇android 在非UI线程更新UI仍然成..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目