Android Studio TextView上下滚动轮播

build.gradle(projcet:...)
allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

build.gradle(Module:app)
compile 'com.github.paradoxie:AutoVerticalTextview:0.1'

代码:
private VerticalTextview textView;
private ArrayList titleList = new ArrayList();

private void init() {
        textView = (VerticalTextview) findViewById(R.id.text);
        titleList.add("你是天上最受宠的一架钢琴");
        titleList.add("我是丑人脸上的鼻涕");
        titleList.add("你发出完美的声音");
        titleList.add("我被默默揩去");
        titleList.add("你冷酷外表下藏着诗情画意");
        titleList.add("我已经够胖还吃东西");
        titleList.add("你踏着七彩祥云离去");
        titleList.add("我被留在这里");
        textView.setTextList(titleList);
        textView.setText(26, 5, Color.RED);//设置属性
        textView.setTextStillTime(3000);//设置停留时长间隔
        textView.setAnimTime(300);//设置进入和退出的时间间隔
        textView.setOnItemClickListener(new VerticalTextview.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                Toast.makeText(MainActivity.this, "点击了 : " + titleList.get(position), Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();
        textView.startAutoScroll();
    }

    @Override
    protected void onPause() {
        super.onPause();
        textView.stopAutoScroll();
    }

xml:


你可能感兴趣的:(Android Studio TextView上下滚动轮播)