在build.gradle(Module:app)添加依赖:
implementation 'com.github.paradoxie:AutoVerticalTextview:0.1'
在build.gradle(Project): allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } }
xml文件里:
<com.paradoxie.autoscrolltextview.VerticalTextview android:id="@+id/TextView" android:layout_width="match_parent" android:layout_height="wrap_content"/>
activity中:
private VerticalTextview TextView; private ArrayList<String> titleList = new ArrayList<>(); onCreate()方法里: titleList.add("赶紧来认清楚!"); titleList.add("原来这全都是骗人的"); titleList.add("夏季阳光强烈); titleList.add("可是很多人还不知道!"); TextView.setTextList(titleList);//加入显示内容,集合类型 TextVie