# MarqueeView **Repository Path**: chen3441251/MarqueeView ## Basic Information - **Project Name**: MarqueeView - **Description**: 俗名:可垂直跑、可水平跑的跑马灯;学名:可垂直翻、可水平翻的翻页公告 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-26 - **Last Updated**: 2024-12-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MarqueeView [ ![Download](https://api.bintray.com/packages/sfsheng0322/maven/marqueeview/images/download.svg) ](https://bintray.com/sfsheng0322/maven/marqueeview/_latestVersion) 俗名:可垂直跑、可水平跑的跑马灯 学名:可垂直翻、可水平翻的翻页公告 ### 效果图 ### 使用 #### Maven: com.sunfusheng marqueeview 1.3.2 pom #### Gradle: compile 'com.sunfusheng:marqueeview:1.3.2' #### 属性 | Attribute 属性 | Description 描述 | |:--- |:---| | mvAnimDuration | 一行文字动画执行时间 | | mvInterval | 两行文字翻页时间间隔 | | mvTextSize | 文字大小 | | mvTextColor | 文字颜色 | | mvGravity | 文字位置:left、center、right | | mvSingleLine | 单行设置 | | mvDirection | 动画滚动方向:bottom_to_top、top_to_bottom、right_to_left、left_to_right | #### XML #### 设置字符串列表数据 MarqueeView marqueeView = (MarqueeView) findViewById(R.id.marqueeView); List info = new ArrayList<>(); info.add("1. 大家好,我是孙福生。"); info.add("2. 欢迎大家关注我哦!"); info.add("3. GitHub帐号:sfsheng0322"); info.add("4. 新浪微博:孙福生微博"); info.add("5. 个人博客:sunfusheng.com"); info.add("6. 微信公众号:孙福生"); marqueeView.startWithList(info); // 在代码里设置自己的动画 marqueeView.startWithList(info, R.anim.anim_bottom_in, R.anim.anim_top_out); #### 设置字符串数据 String notice = "心中有阳光,脚底有力量!心中有阳光,脚底有力量!心中有阳光,脚底有力量!"; marqueeView.startWithText(notice); // 在代码里设置自己的动画 marqueeView.startWithText(notice, R.anim.anim_bottom_in, R.anim.anim_top_out); #### 设置事件监听 marqueeView.setOnItemClickListener(new MarqueeView.OnItemClickListener() { @Override public void onItemClick(int position, TextView textView) { Toast.makeText(getApplicationContext(), String.valueOf(marqueeView1.getPosition()) + ". " + textView.getText(), Toast.LENGTH_SHORT).show(); } }); #### 重影问题可参考以下解决方案 @Override public void onStart() { super.onStart(); marqueeView.startFlipping(); } @Override public void onStop() { super.onStop(); marqueeView.stopFlipping(); } ### [APK下载地址](http://fir.im/MarqueeView) ### 微信公众号 ### 关于我 个人邮箱:sfsheng0322@126.com [GitHub主页](https://github.com/sfsheng0322) [简书主页](http://www.jianshu.com/users/88509e7e2ed1/latest_articles) [个人博客](http://sunfusheng.com/) [新浪微博](http://weibo.com/u/3852192525) License -- Copyright (C) 2016 sfsheng0322@126.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.