Android 仿淘宝头条 -- 垂直滚动广告条

前言介绍

今天我们来实现淘宝APP上 《淘宝头条》基于TextView实现上下滚动循环通知消息的效果。

在这里我们主要通过 ViewFlipper 也就是安卓自带的控件实现的。
很多人可能都很少知道这个控件,这个控件很简单,也很好理解,操作也不是特别困难 (当然这个也因人而异 ,因难易系数而定)

效果图

在这里插入图片描述

操作步骤

1. 先来看整体的页面布局

  • tvTao:此 TextView 控件输入的内容为 淘宝头条
  • viewFen:此 View 控件 充当为样式,分割左右两个控件
  • filpper:此 ViewFlipper 控件可以使内容进行垂直循环滚动
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#fff"
    android:orientation="horizontal"
    tools:context=".textScollView.MarqueeNewsActivity">

    <TextView
        android:id="@+id/tvTao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_margin="8dp"
        android:padding="8dp"
        android:text="淘宝头条"
        android:textColor="@android:color/holo_red_light"
        android:textSize="22sp" />

    <View
        android:id="@+id/viewFen"
        android:layout_width="0.5dp"
        android:layout_height="match_parent"
        android:layout_marginBottom=
  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值