TextSlider Library

Android TextSlider

License

License

MIT
Categories

Categories

IDE Development Tools
GroupId

GroupId

cn.kanejin.textslider
ArtifactId

ArtifactId

library
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

aar
Description

Description

TextSlider Library
Android TextSlider
Project URL

Project URL

https://github.com/KaneJinCN/android-TextSlider
Source Code Management

Source Code Management

https://github.com/KaneJinCN/android-TextSlider

Download library

How to add to project

<!-- https://jarcasting.com/artifacts/cn.kanejin.textslider/library/ -->
<dependency>
    <groupId>cn.kanejin.textslider</groupId>
    <artifactId>library</artifactId>
    <version>1.0.3</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/cn.kanejin.textslider/library/
implementation 'cn.kanejin.textslider:library:1.0.3'
// https://jarcasting.com/artifacts/cn.kanejin.textslider/library/
implementation ("cn.kanejin.textslider:library:1.0.3")
'cn.kanejin.textslider:library:aar:1.0.3'
<dependency org="cn.kanejin.textslider" name="library" rev="1.0.3">
  <artifact name="library" type="aar" />
</dependency>
@Grapes(
@Grab(group='cn.kanejin.textslider', module='library', version='1.0.3')
)
libraryDependencies += "cn.kanejin.textslider" % "library" % "1.0.3"
[cn.kanejin.textslider/library "1.0.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Android文本滑动器

Preview 效果预览

TextSlider Preview 1 Gif TextSlider Preview 2 Gif

Usage 使用方法

  1. 引用TextSlider Library

    在build.gradle中添加依赖

    compile 'cn.kanejin.textslider:library:1.0.3@aar'
  2. 在layout里定义AdBox

    <cn.kanejin.textslider.TextSlider
        android:id="@+id/text_slider"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingLeft="8dp"
        android:background="#ffe822"
        custom:textslider_textColor="@android:color/black"
        custom:textslider_textSize="16sp"
        custom:textslider_duration="500"
        custom:textslider_delay="5000"
        custom:textslider_loop="true"
        custom:textslider_autoPlay="true"
        custom:textslider_rows="3"
        custom:textslider_step="2"
        custom:textslider_rowHeight="36dp" />
    

    查看完整的示例代码

  3. 在Activity里设置Adapter和Listener

    mTextSlider = (TextSlider) findViewById(R.id.text_slider);
    
    DemoTextSliderAdpter adapter = new DemoTextSliderAdpter(this);
    
    mTextSlider.setAdapter(adapter);
    
    mTextSlider.setListener(new TextSliderListener() {
        @Override
        public void onTextClick(TextSlider textSlider, int position, TextItem text) {
            Toast.makeText(MainActivity.this, text.getUrl(), Toast.LENGTH_SHORT).show();
        }
    });

    查看完整的示例代码

Attributes 参数说明

参数名 类型 默认值 说明
textslider_textColor color   文本颜色
textslider_textSize dimension 16sp 文本字体大小
textslider_duration integer 1000 广告切换动画时间, 单位ms
textslider_delay integer 5000 广告停留时间, 单位ms
textslider_loop boolean true 是否循环播放
textslider_autoPlay boolean true 是否自动播放
textslider_rows integer 1 显示行数
textslider_rowHeight dimension 24dp 每行高度
textslider_step integer 1 每次滑动行数

License 许可

MIT

See Also 参阅

AdBox

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0