├── .gitignore ├── .idea ├── assetWizardSettings.xml ├── caches │ ├── build_file_checksums.ser │ └── gradle_models.ser ├── codeStyles │ └── Project.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── markdown-navigator.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── GIF.gif ├── README.md ├── ScrollTextviewLib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── anylife │ │ └── scrolltextview │ │ └── ScrollTextView.java │ └── res │ └── values │ ├── attrs.xml │ └── strings.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── anylife │ │ └── fragment │ │ └── scrolltextview │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-playstore.png │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── anylife │ │ │ └── fragment │ │ │ ├── scrolltextview │ │ │ ├── LauncherActivity.java │ │ │ └── SettingActivity.java │ │ │ └── test │ │ │ └── TestActivity.kt │ └── res │ │ ├── drawable-anydpi │ │ └── setting.xml │ │ ├── drawable-hdpi │ │ └── setting.png │ │ ├── drawable-mdpi │ │ └── setting.png │ │ ├── drawable-xhdpi │ │ ├── cancel.png │ │ ├── car_license.png │ │ ├── parking_no.png │ │ ├── phone_no.png │ │ ├── room_no.png │ │ ├── service.png │ │ └── setting.png │ │ ├── drawable-xxhdpi │ │ └── setting.png │ │ ├── drawable │ │ ├── ic_baseline_add_task_24.xml │ │ ├── ic_baseline_arrow_back_24.xml │ │ └── ic_launcher_foreground.xml │ │ ├── layout │ │ ├── activity_launcher.xml │ │ ├── activity_setting.xml │ │ ├── activity_test.xml │ │ └── color_pop_win.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── anylife │ └── fragment │ └── scrolltextview │ └── ExampleUnitTest.java ├── build.gradle ├── device-2018-09-13-171013.png ├── font.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | *.bak 10 | build/* 11 | */build/* 12 | .idea/* 13 | .gradle/* 14 | .externalNativeBuild 15 | gradle/* 16 | local.properties 17 | lebang-android.properties 18 | *.iml 19 | .DS_Store 20 | gradle.properties 21 | *.hprof 22 | dbMaster/ 23 | www/* 24 | -------------------------------------------------------------------------------- /.idea/assetWizardSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 363 | 364 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/caches/gradle_models.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/.idea/caches/gradle_models.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 |
31 | 32 | 33 | 34 | xmlns:android 35 | 36 | ^$ 37 | 38 | 39 | 40 |
41 |
42 | 43 | 44 | 45 | xmlns:.* 46 | 47 | ^$ 48 | 49 | 50 | BY_NAME 51 | 52 |
53 |
54 | 55 | 56 | 57 | .*:id 58 | 59 | http://schemas.android.com/apk/res/android 60 | 61 | 62 | 63 |
64 |
65 | 66 | 67 | 68 | .*:name 69 | 70 | http://schemas.android.com/apk/res/android 71 | 72 | 73 | 74 |
75 |
76 | 77 | 78 | 79 | name 80 | 81 | ^$ 82 | 83 | 84 | 85 |
86 |
87 | 88 | 89 | 90 | style 91 | 92 | ^$ 93 | 94 | 95 | 96 |
97 |
98 | 99 | 100 | 101 | .* 102 | 103 | ^$ 104 | 105 | 106 | BY_NAME 107 | 108 |
109 |
110 | 111 | 112 | 113 | .* 114 | 115 | http://schemas.android.com/apk/res/android 116 | 117 | 118 | ANDROID_ATTRIBUTE_ORDER 119 | 120 |
121 |
122 | 123 | 124 | 125 | .* 126 | 127 | .* 128 | 129 | 130 | BY_NAME 131 | 132 |
133 |
134 |
135 |
136 |
137 |
-------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 21 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 37 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 1.8 72 | 73 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/GIF.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About ScrollTextView 2 | 3 | Class ScrollTextView extends SurfaceView implements SurfaceHolder.Callback 4 | 5 | Android 滚动字幕,如新闻联播下面的,可以使用在广告机,滚动新闻信息,机场地铁等信息发布系统。 6 | 以前是在信息发布系统上使用过,作为动态布局的一部分,题外话,如果有想做像分众传媒或者类似的 7 | 电梯广告的可以参考一下. 8 | 9 | You can use it in advisement player,TV news show or airport metro information public system App. 10 | 11 | 12 | 动态布局专利:http://www.google.com/patents/CN103336691A?cl=zh (科学上网打开) 13 | 14 | 继承SurfaceView 实现,CPU 占用低,无内存抖动,以Nexus5X,Android 7.0 上测试流畅度很好, 15 | 大部分品牌手机测试兼容性良好。 16 | 17 | 18 | # How to use 19 | 20 | ## Gradle 集成使用 (2.4.0 支持AndroidX,并且Target SDK=33) 21 | 22 | ``` 23 | implementation 'io.github.anylifezlb:ScrollTextviewLib:2.4.0' 24 | ``` 25 | 26 | ## 基础设置代码概要 27 | 28 | ``` 29 | 44 | ``` 45 | 46 | 或者在代码中 47 | 48 | ``` 49 | scrollText = findViewById(R.id.scrollText); 50 | scrollText.setSpeed(4); 51 | scrollText.setText("new text"); 52 | scrollText.setTextColor(0xffad43ae); 53 | ``` 54 | 55 | # 关于提Issues 56 | 57 | 本库一直在持续维护中,但是能投入的时间不多,有issues 的同学说明一下以下内容 58 | 59 | - 1.使用场景: 比如ViewPager+fragment 滑动切换出现XX和YY 问题 60 | - 2.Android系统信息: 手机品牌或特殊设备描述,Android系统版本号等信息 61 | 62 | 63 | . 64 | ## Any questions,please contact me at: anylife.zlb@gmail.com 65 | 66 | 视频看起来卡顿是录制调低了帧律以便快速上传和播放。 67 | 68 | 69 | https://user-images.githubusercontent.com/15169396/208380192-b323699f-adc8-4116-8fbd-d90c83e91544.mp4 70 | -------------------------------------------------------------------------------- /ScrollTextviewLib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ScrollTextviewLib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: "com.vanniktech.maven.publish" 3 | 4 | 5 | android { 6 | compileSdkVersion 33 7 | 8 | defaultConfig { 9 | minSdkVersion 15 10 | targetSdkVersion 33 11 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | lint { 21 | abortOnError false 22 | checkReleaseBuilds false 23 | } 24 | namespace 'anylife.scrolltextview' 25 | 26 | 27 | } 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | implementation 'androidx.appcompat:appcompat:1.5.1' 32 | } 33 | -------------------------------------------------------------------------------- /ScrollTextviewLib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /ScrollTextviewLib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ScrollTextviewLib/src/main/java/anylife/scrolltextview/ScrollTextView.java: -------------------------------------------------------------------------------- 1 | package anylife.scrolltextview; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.graphics.Paint.FontMetrics; 9 | import android.graphics.PixelFormat; 10 | import android.graphics.PorterDuff.Mode; 11 | import androidx.annotation.ColorInt; 12 | import android.util.AttributeSet; 13 | import android.util.Log; 14 | import android.view.MotionEvent; 15 | import android.view.SurfaceHolder; 16 | import android.view.SurfaceView; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.concurrent.Executors; 22 | import java.util.concurrent.ScheduledExecutorService; 23 | import java.util.concurrent.TimeUnit; 24 | 25 | /** 26 | * Android auto Scroll Text,like TV News,AD devices 27 | * 28 | * 29 | * @author anylife.zlb@gmail.com 2013/09/02 30 | */ 31 | public class ScrollTextView extends SurfaceView implements SurfaceHolder.Callback { 32 | private final String TAG = "ScrollTextView"; 33 | // surface Handle onto a raw buffer that is being managed by the screen compositor. 34 | private SurfaceHolder surfaceHolder; //providing access and control over this SurfaceView's underlying surface. 35 | 36 | private Paint paint = null; 37 | private boolean stopScroll = false; // stop scroll 38 | private boolean pauseScroll = false; // pause scroll 39 | 40 | //Default value 41 | private boolean clickEnable = false; // click to stop/start 42 | public boolean isHorizontal = true; // horizontal|V 43 | private int speed = 4; // scroll-speed 44 | private String text = ""; // scroll text 45 | private float textSize = 20f; // default text size 46 | private int textColor; 47 | private int textBackColor=0x00000000; 48 | 49 | private int needScrollTimes = Integer.MAX_VALUE; //scroll times 50 | 51 | private int viewWidth = 0; 52 | private int viewHeight = 0; 53 | private float textWidth = 0f; 54 | private float textX = 0f; 55 | private float textY = 0f; 56 | private float viewWidth_plus_textLength = 0.0f; 57 | 58 | private ScheduledExecutorService scheduledExecutorService; 59 | 60 | boolean isSetNewText = false; 61 | boolean isScrollForever = true; 62 | 63 | private Canvas canvas; 64 | 65 | /** 66 | * constructs 1 67 | * 68 | * @param context you should know 69 | */ 70 | public ScrollTextView(Context context) { 71 | super(context); 72 | } 73 | 74 | /** 75 | * constructs 2 76 | * 77 | * @param context CONTEXT 78 | * @param attrs ATTRS 79 | */ 80 | public ScrollTextView(Context context, AttributeSet attrs) { 81 | super(context, attrs); 82 | surfaceHolder = this.getHolder(); //get The surface holder 83 | surfaceHolder.addCallback(this); 84 | paint = new Paint(); 85 | TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.ScrollTextView); 86 | clickEnable = arr.getBoolean(R.styleable.ScrollTextView_clickEnable, clickEnable); 87 | isHorizontal = arr.getBoolean(R.styleable.ScrollTextView_isHorizontal, isHorizontal); 88 | speed = arr.getInteger(R.styleable.ScrollTextView_speed, speed); 89 | text = arr.getString(R.styleable.ScrollTextView_text); 90 | textColor = arr.getColor(R.styleable.ScrollTextView_text_color, Color.BLACK); 91 | textSize = arr.getDimension(R.styleable.ScrollTextView_text_size, textSize); 92 | needScrollTimes = arr.getInteger(R.styleable.ScrollTextView_times, Integer.MAX_VALUE); 93 | isScrollForever = arr.getBoolean(R.styleable.ScrollTextView_isScrollForever, true); 94 | 95 | paint.setColor(textColor); 96 | paint.setTextSize(textSize); 97 | 98 | paint.setFlags(Paint.ANTI_ALIAS_FLAG); 99 | paint.setAntiAlias(true); 100 | paint.setFilterBitmap(true); 101 | 102 | setZOrderOnTop(true); //Control whether the surface view's surface is placed on top of its window. 103 | getHolder().setFormat(PixelFormat.TRANSLUCENT); 104 | 105 | setFocusable(true); 106 | arr.recycle(); 107 | } 108 | 109 | /** 110 | * measure text height width 111 | * 112 | * @param widthMeasureSpec widthMeasureSpec 113 | * @param heightMeasureSpec heightMeasureSpec 114 | */ 115 | @Override 116 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 117 | // TODO Auto-generated method stub 118 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 119 | 120 | int mHeight = getFontHeight(textSize); //实际的视图高 121 | viewWidth = MeasureSpec.getSize(widthMeasureSpec); 122 | viewHeight = MeasureSpec.getSize(heightMeasureSpec); 123 | 124 | // when layout width or height is wrap_content ,should init ScrollTextView Width/Height 125 | if (getLayoutParams().width == ViewGroup.LayoutParams.WRAP_CONTENT && getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) { 126 | setMeasuredDimension(viewWidth, mHeight); 127 | viewHeight = mHeight; 128 | } else if (getLayoutParams().width == ViewGroup.LayoutParams.WRAP_CONTENT) { 129 | setMeasuredDimension(viewWidth, viewHeight); 130 | } else if (getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) { 131 | setMeasuredDimension(viewWidth, mHeight); 132 | viewHeight = mHeight; 133 | } 134 | } 135 | 136 | 137 | /** 138 | * surfaceChanged 139 | * 140 | * @param arg0 arg0 141 | * @param arg1 arg1 142 | * @param arg2 arg1 143 | * @param arg3 arg1 144 | */ 145 | @Override 146 | public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) { 147 | Log.d(TAG, "arg0:" + arg0.toString() + " arg1:" + arg1 + " arg2:" + arg2 + " arg3:" + arg3); 148 | } 149 | 150 | /** 151 | * surfaceCreated,init a new scroll thread. 152 | * lockCanvas 153 | * Draw something 154 | * unlockCanvasAndPost 155 | * 156 | * @param holder holder 157 | */ 158 | @Override 159 | public void surfaceCreated(SurfaceHolder holder) { 160 | stopScroll = false; 161 | scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); 162 | scheduledExecutorService.scheduleAtFixedRate(new ScrollTextThread(), 100, 100, TimeUnit.MILLISECONDS); 163 | Log.d(TAG, "ScrollTextTextView is created"); 164 | } 165 | 166 | /** 167 | * surfaceDestroyed 168 | * 169 | * @param arg0 SurfaceHolder 170 | */ 171 | @Override 172 | public void surfaceDestroyed(SurfaceHolder arg0) { 173 | synchronized(this){ 174 | stopScroll=true; 175 | } 176 | 177 | scheduledExecutorService.shutdownNow(); 178 | 179 | // surfaceHolder.removeCallback(this); 180 | // surfaceHolder.getSurface().release(); 181 | // surfaceHolder = null; 182 | 183 | Log.d(TAG, "ScrollTextTextView is destroyed"); 184 | } 185 | 186 | 187 | /** 188 | * text height 189 | * 190 | * @param fontSize fontSize 191 | * @return fontSize`s height 192 | */ 193 | private int getFontHeight(float fontSize) { 194 | Paint paint = new Paint(); 195 | paint.setTextSize(fontSize); 196 | FontMetrics fm = paint.getFontMetrics(); 197 | return (int) Math.ceil(fm.descent - fm.ascent); 198 | } 199 | 200 | /** 201 | * get Background color 202 | * 203 | * @return textBackColor 204 | */ 205 | public int getBackgroundColor(){ 206 | return textBackColor; 207 | } 208 | 209 | 210 | /** 211 | * set background color 212 | * 213 | * @param color textBackColor 214 | */ 215 | public void setScrollTextBackgroundColor(int color){ 216 | this.setBackgroundColor(color); 217 | this.textBackColor=color; 218 | } 219 | 220 | 221 | /** 222 | * get speed 223 | * 224 | * @return speed 225 | */ 226 | public int getSpeed() { 227 | return speed; 228 | } 229 | 230 | /** 231 | * get Text 232 | * 233 | * @return 234 | */ 235 | public String getText() { 236 | return text; 237 | } 238 | 239 | /** 240 | * get text size 241 | * 242 | * @return px 243 | */ 244 | public float getTextSize() { 245 | return px2sp(this.getContext(),textSize); 246 | } 247 | 248 | 249 | /** 250 | * get text color 251 | * 252 | * @return textColor 253 | */ 254 | public int getTextColor() { 255 | return textColor; 256 | } 257 | 258 | /** 259 | * set scroll times 260 | * 261 | * @param times scroll times 262 | */ 263 | public void setTimes(int times) { 264 | if (times <= 0) { 265 | throw new IllegalArgumentException("times was invalid integer, it must between > 0"); 266 | } else { 267 | needScrollTimes = times; 268 | isScrollForever = false; 269 | } 270 | } 271 | 272 | 273 | /** 274 | * set scroll text size SP 275 | * 276 | * @param textSizeTem scroll times 277 | */ 278 | public void setTextSize(float textSizeTem) { 279 | if (textSize < 20) { 280 | throw new IllegalArgumentException("textSize must > 20"); 281 | } else if (textSize > 900) { 282 | throw new IllegalArgumentException("textSize must < 900"); 283 | } else { 284 | 285 | this.textSize=sp2px(getContext(), textSizeTem); 286 | //重新设置Size 287 | paint.setTextSize(textSize); 288 | //视图区域也要改变 289 | measureVarious(); 290 | 291 | //实际的视图高,thanks to WG 292 | int mHeight = getFontHeight(textSizeTem); 293 | android.view.ViewGroup.LayoutParams lp = this.getLayoutParams(); 294 | lp.width = viewWidth; 295 | lp.height = dip2px(this.getContext(), mHeight); 296 | this.setLayoutParams(lp); 297 | 298 | isSetNewText = true; 299 | } 300 | } 301 | 302 | /** 303 | * dp to px 304 | * 305 | * @param context c 306 | * @param dpValue dp 307 | * @return 308 | */ 309 | private int dip2px(Context context, float dpValue) { 310 | final float scale = context.getResources().getDisplayMetrics().density; 311 | return (int) (dpValue * scale + 0.5f); 312 | } 313 | 314 | /** 315 | * sp to px 316 | * 317 | * @param context c 318 | * @param spValue sp 319 | * @return 320 | */ 321 | private int sp2px(Context context, float spValue) { 322 | float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 323 | return (int) (spValue * fontScale + 0.5f); 324 | } 325 | 326 | 327 | public int px2sp(Context context, float pxValue) { 328 | float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 329 | return (int) (pxValue / fontScale + 0.5f); 330 | } 331 | 332 | 333 | /** 334 | * isHorizontal or vertical 335 | * 336 | * @param horizontal isHorizontal or vertical 337 | */ 338 | public void setHorizontal(boolean horizontal) { 339 | isHorizontal = horizontal; 340 | } 341 | 342 | /** 343 | * set scroll text 344 | * 345 | * @param newText scroll text 346 | */ 347 | public void setText(String newText) { 348 | isSetNewText = true; 349 | stopScroll = false; 350 | this.text = newText; 351 | measureVarious(); 352 | } 353 | 354 | 355 | /** 356 | * Set the text color 357 | * 358 | * @param color A color value in the form 0xAARRGGBB. 359 | */ 360 | public void setTextColor(@ColorInt int color) { 361 | textColor = color; 362 | paint.setColor(textColor); 363 | } 364 | 365 | 366 | /** 367 | * set scroll speed 368 | * 369 | * @param speed SCROLL SPEED [4,14] ///// 0? 370 | */ 371 | public void setSpeed(int speed) { 372 | if (speed > 14 || speed < 4) { 373 | throw new IllegalArgumentException("Speed was invalid integer, it must between 4 and 14"); 374 | } else { 375 | this.speed = speed; 376 | } 377 | } 378 | 379 | 380 | /** 381 | * scroll text forever 382 | * 383 | * @param scrollForever scroll forever or not 384 | */ 385 | public void setScrollForever(boolean scrollForever) { 386 | isScrollForever = scrollForever; 387 | } 388 | 389 | 390 | public boolean isPauseScroll() { 391 | return pauseScroll; 392 | } 393 | 394 | public void setPauseScroll(boolean pauseScroll) { 395 | this.pauseScroll = pauseScroll; 396 | } 397 | 398 | /** 399 | * touch to stop / start 400 | */ 401 | @Override 402 | public boolean onTouchEvent(MotionEvent event) { 403 | if (!clickEnable) { 404 | return true; 405 | } 406 | 407 | switch (event.getAction()) { 408 | case MotionEvent.ACTION_DOWN: 409 | pauseScroll = !pauseScroll; 410 | break; 411 | } 412 | return true; 413 | 414 | } 415 | 416 | 417 | /** 418 | * scroll text vertical 419 | */ 420 | private void drawVerticalScroll() { 421 | List strings = new ArrayList<>(); 422 | int start = 0, end = 0; 423 | while (end < text.length()) { 424 | while (paint.measureText(text.substring(start, end)) < viewWidth && end < text.length()) { 425 | end++; 426 | } 427 | if (end == text.length()) { 428 | strings.add(text.substring(start, end)); 429 | break; 430 | } else { 431 | end--; 432 | strings.add(text.substring(start, end)); 433 | start = end; 434 | } 435 | } 436 | 437 | float fontHeight = paint.getFontMetrics().bottom - paint.getFontMetrics().top; 438 | 439 | FontMetrics fontMetrics = paint.getFontMetrics(); 440 | float distance = (fontMetrics.bottom - fontMetrics.top) / 2 - fontMetrics.bottom; 441 | float baseLine = viewHeight / 2 + distance; 442 | 443 | for (int n = 0; n < strings.size(); n++) { 444 | for (float i = viewHeight + fontHeight; i > -fontHeight; i = i - 3) { 445 | if (stopScroll || isSetNewText) { 446 | return; 447 | } 448 | 449 | if (pauseScroll) { 450 | try { 451 | Thread.sleep(1000); 452 | } catch (InterruptedException e) { 453 | Log.e(TAG, e.toString()); 454 | } 455 | continue; 456 | } 457 | 458 | 459 | try { 460 | canvas = surfaceHolder.lockCanvas(); 461 | canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR); 462 | canvas.drawText(strings.get(n), 0, i, paint); 463 | }catch (Exception e ){ 464 | 465 | }finally { 466 | surfaceHolder.unlockCanvasAndPost(canvas); 467 | } 468 | 469 | if (i - baseLine < 4 && i - baseLine > 0) { 470 | if (stopScroll) { 471 | return; 472 | } 473 | try { 474 | Thread.sleep(speed * 1000); 475 | } catch (InterruptedException e) { 476 | Log.e(TAG, e.toString()); 477 | } 478 | } 479 | } 480 | } 481 | } 482 | 483 | /** 484 | * Draw text 485 | * 486 | * @param X X 487 | * @param Y Y 488 | */ 489 | private synchronized void draw(float X, float Y) { 490 | try { 491 | canvas = surfaceHolder.lockCanvas(); 492 | canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR); 493 | canvas.drawText(text, X, Y, paint); 494 | }catch (Exception e){ 495 | 496 | }finally { 497 | surfaceHolder.unlockCanvasAndPost(canvas); 498 | } 499 | } 500 | 501 | 502 | @Override 503 | protected void onVisibilityChanged(View changedView, int visibility) { 504 | super.onVisibilityChanged(changedView, visibility); 505 | this.setVisibility(visibility); 506 | } 507 | 508 | /** 509 | * measure text 510 | */ 511 | private void measureVarious() { 512 | textWidth = paint.measureText(text); 513 | viewWidth_plus_textLength = viewWidth + textWidth; 514 | textX = viewWidth - viewWidth / 5; 515 | 516 | //baseline measure ! 517 | FontMetrics fontMetrics = paint.getFontMetrics(); 518 | float distance = (fontMetrics.bottom - fontMetrics.top) / 2 - fontMetrics.bottom; 519 | textY = viewHeight / 2 + distance; 520 | } 521 | 522 | 523 | /** 524 | * Scroll thread 525 | * 526 | */ 527 | class ScrollTextThread implements Runnable { 528 | @Override 529 | public void run() { 530 | 531 | measureVarious(); 532 | 533 | while (!stopScroll&&surfaceHolder!=null&& !Thread.currentThread().isInterrupted()) { 534 | 535 | // NoNeed Scroll,短文不滚动,居中 ?暂时不支持吧 536 | // if (textWidth < getWidth()) { 537 | // draw(1, textY); 538 | // stopScroll = true; 539 | // break; 540 | // } 541 | 542 | if (isHorizontal) { 543 | if (pauseScroll) { 544 | try { 545 | Thread.sleep(1000); 546 | } catch (InterruptedException e) { 547 | Log.e(TAG, e.toString()); 548 | } 549 | continue; 550 | } 551 | 552 | draw(viewWidth - textX, textY); 553 | textX += speed; 554 | if (textX > viewWidth_plus_textLength) { 555 | textX = 0; 556 | --needScrollTimes; 557 | } 558 | } else { 559 | drawVerticalScroll(); 560 | isSetNewText = false; 561 | --needScrollTimes; 562 | } 563 | 564 | if (needScrollTimes <= 0 && isScrollForever) { 565 | stopScroll = true; 566 | } 567 | 568 | } 569 | } 570 | } 571 | 572 | } 573 | -------------------------------------------------------------------------------- /ScrollTextviewLib/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ScrollTextviewLib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ScrollTextView 3 | 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 33 5 | 6 | defaultConfig { 7 | applicationId "com.anylife.fragment.scrolltextview" 8 | minSdkVersion 16 9 | targetSdkVersion 33 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | lint { 21 | abortOnError false 22 | } 23 | namespace 'com.anylife.fragment.scrolltextview' 24 | 25 | 26 | } 27 | 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | implementation 'androidx.appcompat:appcompat:1.5.1' 32 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 33 | 34 | implementation 'com.larswerkman:HoloColorPicker:1.5' //颜色选择 35 | implementation project(':ScrollTextviewLib') 36 | implementation 'com.google.android.material:material:1.7.0' //依赖 library ScrollTextViewLib 37 | 38 | // implementation 'io.github.anylifezlb:ScrollTextView:2.1.0' 39 | } 40 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/anylife/fragment/scrolltextview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.anylife.fragment.scrolltextview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 13 | 16 | 17 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/anylife/fragment/scrolltextview/LauncherActivity.java: -------------------------------------------------------------------------------- 1 | package com.anylife.fragment.scrolltextview; 2 | 3 | import android.content.Intent; 4 | import android.os.Build; 5 | import androidx.annotation.Nullable; 6 | import androidx.appcompat.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.text.TextUtils; 9 | import android.view.View; 10 | import anylife.scrolltextview.ScrollTextView; 11 | 12 | /** 13 | * 跑马灯设置 14 | * 15 | */ 16 | public class LauncherActivity extends AppCompatActivity { 17 | public static final String TEXT_INPUT_KEY = "textInput"; 18 | public static final String SCROLL_SIZE_KEY = "scrollSize"; 19 | public static final String SCROLL_SPEED_KEY = "scrollSpeed"; 20 | public static final String TEXT_COLOR_KEY = "textColor"; 21 | public static final String TEXT_BG_COLOR_KEY = "textBgColor"; 22 | 23 | public static final int REQUEST_SETTING_CODE = 0x0001; 24 | 25 | private ScrollTextView scrollTextView; 26 | 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | hideBottomUIMenu(); 32 | setContentView(R.layout.activity_launcher); 33 | scrollTextView = findViewById(R.id.scrollText); 34 | 35 | findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() { 36 | @Override 37 | public void onClick(View v) { 38 | Intent intent = new Intent(LauncherActivity.this, SettingActivity.class); 39 | 40 | intent.putExtra(TEXT_INPUT_KEY, scrollTextView.getText()); 41 | intent.putExtra(SCROLL_SIZE_KEY, scrollTextView.getTextSize()); 42 | intent.putExtra(SCROLL_SPEED_KEY, scrollTextView.getSpeed()); 43 | intent.putExtra(TEXT_COLOR_KEY, scrollTextView.getTextColor()); 44 | intent.putExtra(TEXT_BG_COLOR_KEY, scrollTextView.getBackgroundColor()); 45 | 46 | startActivityForResult(intent, REQUEST_SETTING_CODE); 47 | } 48 | }); 49 | 50 | 51 | } 52 | 53 | 54 | 55 | /** 56 | * 隐藏虚拟按键,并且全屏 57 | */ 58 | protected void hideBottomUIMenu() { 59 | //隐藏虚拟按键,并且全屏 60 | if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { 61 | View v = this.getWindow().getDecorView(); 62 | v.setSystemUiVisibility(View.GONE); 63 | } else if (Build.VERSION.SDK_INT >= 19) { 64 | //for new api versions. 65 | View decorView = getWindow().getDecorView(); 66 | int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 67 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN; 68 | decorView.setSystemUiVisibility(uiOptions); 69 | } 70 | } 71 | 72 | 73 | @Override 74 | protected void onSaveInstanceState(Bundle outState) { 75 | super.onSaveInstanceState(outState); 76 | outState.putString(TEXT_INPUT_KEY, scrollTextView.getText()); 77 | outState.putFloat(SCROLL_SIZE_KEY, scrollTextView.getTextSize()); 78 | outState.putInt(SCROLL_SPEED_KEY, scrollTextView.getSpeed()); 79 | outState.putInt(TEXT_COLOR_KEY, scrollTextView.getTextColor()); 80 | outState.putInt(TEXT_BG_COLOR_KEY, scrollTextView.getBackgroundColor()); 81 | } 82 | 83 | @Override 84 | protected void onRestoreInstanceState(Bundle savedInstanceState) { 85 | super.onRestoreInstanceState(savedInstanceState); 86 | 87 | scrollTextView.setText(savedInstanceState.getString(TEXT_INPUT_KEY)); 88 | scrollTextView.setTextSize(savedInstanceState.getFloat(SCROLL_SIZE_KEY)); 89 | scrollTextView.setSpeed(savedInstanceState.getInt(SCROLL_SPEED_KEY)); 90 | scrollTextView.setTextColor(savedInstanceState.getInt(TEXT_COLOR_KEY)); 91 | scrollTextView.setBackgroundColor(savedInstanceState.getInt(TEXT_BG_COLOR_KEY)); 92 | } 93 | 94 | @Override 95 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 96 | super.onActivityResult(requestCode, resultCode, data); 97 | scrollTextView.setPauseScroll(false); //防止设置了暂停影响演示 98 | 99 | if (requestCode == REQUEST_SETTING_CODE && resultCode == RESULT_OK) { 100 | int scrollSpeed = data.getIntExtra(SCROLL_SPEED_KEY, 0); 101 | if (0 != scrollSpeed) { 102 | scrollTextView.setSpeed(scrollSpeed); 103 | } 104 | 105 | float scrollSize = data.getFloatExtra(SCROLL_SIZE_KEY, 0f); 106 | if (0 != scrollSize) { 107 | scrollTextView.setTextSize(scrollSize); 108 | } 109 | 110 | int textColor = data.getIntExtra(TEXT_COLOR_KEY, 0); 111 | if (0 != textColor) { 112 | scrollTextView.setTextColor(textColor); 113 | } 114 | 115 | int textBgColor = data.getIntExtra(TEXT_BG_COLOR_KEY, 0); 116 | if (0 != textColor) { 117 | scrollTextView.setScrollTextBackgroundColor(textBgColor); 118 | } 119 | 120 | if (!TextUtils.isEmpty(data.getStringExtra(TEXT_INPUT_KEY))) { 121 | scrollTextView.setText(data.getStringExtra(TEXT_INPUT_KEY)); 122 | } 123 | } 124 | } 125 | 126 | 127 | 128 | 129 | } 130 | -------------------------------------------------------------------------------- /app/src/main/java/com/anylife/fragment/scrolltextview/SettingActivity.java: -------------------------------------------------------------------------------- 1 | package com.anylife.fragment.scrolltextview; 2 | 3 | import android.content.Intent; 4 | import android.os.Build; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.text.TextUtils; 8 | import android.view.Gravity; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.Button; 13 | import android.widget.EditText; 14 | import android.widget.ImageView; 15 | import android.widget.PopupWindow; 16 | import android.widget.SeekBar; 17 | import android.widget.TextView; 18 | import com.larswerkman.holocolorpicker.ColorPicker; 19 | import anylife.scrolltextview.ScrollTextView; 20 | import static com.anylife.fragment.scrolltextview.LauncherActivity.SCROLL_SIZE_KEY; 21 | import static com.anylife.fragment.scrolltextview.LauncherActivity.SCROLL_SPEED_KEY; 22 | import static com.anylife.fragment.scrolltextview.LauncherActivity.TEXT_BG_COLOR_KEY; 23 | import static com.anylife.fragment.scrolltextview.LauncherActivity.TEXT_COLOR_KEY; 24 | import static com.anylife.fragment.scrolltextview.LauncherActivity.TEXT_INPUT_KEY; 25 | 26 | /** 27 | * 设置页面 Settings 28 | * 29 | */ 30 | public class SettingActivity extends AppCompatActivity { 31 | private ImageView closeBtn; 32 | private ScrollTextView scrollTextView; 33 | 34 | private int textColor, textBgColor; 35 | 36 | private int scrollSpeed = 5; 37 | private float scrollSize = 20f; 38 | private EditText editText; 39 | 40 | 41 | @Override 42 | protected void onCreate(Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | hideBottomUIMenu(); 45 | setContentView(R.layout.activity_setting); 46 | scrollTextView = findViewById(R.id.scrollText); 47 | closeBtn = findViewById(R.id.close); 48 | editText = findViewById(R.id.text_input); 49 | 50 | scrollTextView.setTextSize(getIntent().getFloatExtra(SCROLL_SIZE_KEY, scrollSize)); 51 | scrollTextView.setSpeed(getIntent().getIntExtra(SCROLL_SPEED_KEY, scrollSpeed)); 52 | scrollTextView.setTextColor(getIntent().getIntExtra(TEXT_COLOR_KEY, 0)); 53 | scrollTextView.setScrollTextBackgroundColor(getIntent().getIntExtra(TEXT_BG_COLOR_KEY, 0)); 54 | 55 | if (!TextUtils.isEmpty(getIntent().getStringExtra(TEXT_INPUT_KEY))) { 56 | scrollTextView.setText(getIntent().getStringExtra(TEXT_INPUT_KEY)); 57 | editText.setText(getIntent().getStringExtra(TEXT_INPUT_KEY)); 58 | } 59 | 60 | closeBtn.setOnClickListener(v -> { 61 | Intent intent = new Intent(); 62 | intent.putExtra(TEXT_INPUT_KEY, editText.getText().toString()); 63 | intent.putExtra(SCROLL_SIZE_KEY, scrollTextView.getTextSize()); 64 | intent.putExtra(SCROLL_SPEED_KEY, scrollSpeed); 65 | intent.putExtra(TEXT_COLOR_KEY, textColor); 66 | intent.putExtra(TEXT_BG_COLOR_KEY, textBgColor); 67 | setResult(RESULT_OK, intent); 68 | finish(); 69 | }); 70 | 71 | TextView textColorView = findViewById(R.id.text_color); 72 | textColorView.setOnClickListener(new View.OnClickListener() { 73 | @Override 74 | public void onClick(View v) { 75 | selectColor(true); 76 | } 77 | }); 78 | 79 | TextView textBgView = findViewById(R.id.bg_color); 80 | textBgView.setOnClickListener(new View.OnClickListener() { 81 | @Override 82 | public void onClick(View v) { 83 | selectColor(false); 84 | } 85 | }); 86 | 87 | SeekBar textSizeSeekBar = findViewById(R.id.text_size_seek_bar); 88 | textSizeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 89 | @Override 90 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 91 | scrollTextView.setTextSize(progress); 92 | scrollSize = progress; 93 | } 94 | 95 | @Override 96 | public void onStartTrackingTouch(SeekBar seekBar) { 97 | } 98 | 99 | @Override 100 | public void onStopTrackingTouch(SeekBar seekBar) { 101 | } 102 | }); 103 | 104 | SeekBar textSpeedSeekBar = findViewById(R.id.text_speed_seek_bar); 105 | textSpeedSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 106 | @Override 107 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 108 | scrollTextView.setSpeed(progress); 109 | scrollSpeed = progress; 110 | } 111 | 112 | @Override 113 | public void onStartTrackingTouch(SeekBar seekBar) { 114 | } 115 | 116 | @Override 117 | public void onStopTrackingTouch(SeekBar seekBar) { 118 | } 119 | }); 120 | } 121 | 122 | PopupWindow mPopWindow; 123 | 124 | private void selectColor(final boolean isSetTextColor) { 125 | View contentView = LayoutInflater.from(SettingActivity.this).inflate(R.layout.color_pop_win, null); 126 | mPopWindow = new PopupWindow(contentView, 127 | ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); 128 | 129 | //显示PopupWindow 130 | View rootView = LayoutInflater.from(SettingActivity.this).inflate(R.layout.activity_setting, null); 131 | mPopWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0); 132 | 133 | final ColorPicker picker = contentView.findViewById(R.id.picker); 134 | Button confirm = contentView.findViewById(R.id.confirm); 135 | 136 | //To get the color 137 | picker.getColor(); 138 | picker.setOldCenterColor(picker.getColor()); 139 | 140 | picker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() { 141 | @Override 142 | public void onColorChanged(int color) { 143 | if (isSetTextColor) { 144 | scrollTextView.setTextColor(picker.getColor()); 145 | textColor = picker.getColor(); 146 | } else { 147 | textBgColor = picker.getColor(); 148 | scrollTextView.setScrollTextBackgroundColor(textBgColor); 149 | } 150 | } 151 | }); 152 | picker.setShowOldCenterColor(false); 153 | confirm.setOnClickListener(new View.OnClickListener() { 154 | @Override 155 | public void onClick(View v) { 156 | mPopWindow.dismiss(); 157 | } 158 | }); 159 | } 160 | 161 | 162 | /** 163 | * 隐藏虚拟按键,并且全屏 164 | */ 165 | protected void hideBottomUIMenu() { 166 | //隐藏虚拟按键,并且全屏 167 | if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { 168 | View v = this.getWindow().getDecorView(); 169 | v.setSystemUiVisibility(View.GONE); 170 | } else if (Build.VERSION.SDK_INT >= 19) { 171 | //for new api versions. 172 | View decorView = getWindow().getDecorView(); 173 | int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 174 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN; 175 | decorView.setSystemUiVisibility(uiOptions); 176 | } 177 | } 178 | 179 | 180 | } 181 | -------------------------------------------------------------------------------- /app/src/main/java/com/anylife/fragment/test/TestActivity.kt: -------------------------------------------------------------------------------- 1 | package com.anylife.fragment.test 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import com.anylife.fragment.scrolltextview.R 6 | 7 | /** 8 | * Test Activity 9 | * 10 | */ 11 | class TestActivity : AppCompatActivity() { 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_test) 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-anydpi/setting.xml: -------------------------------------------------------------------------------- 1 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-hdpi/setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-mdpi/setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/cancel.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/car_license.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/car_license.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/parking_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/parking_no.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/phone_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/phone_no.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/room_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/room_no.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/service.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xhdpi/setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnyLifeZLB/ScrollTextView/67459cdab3a34a46e66043aea6053d90cc4f8c63/app/src/main/res/drawable-xxhdpi/setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_add_task_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_arrow_back_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 12 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 27 | 28 | 37 | 38 | 45 | 46 | 50 | 51 | 59 | 60 | 70 | 71 | 72 | 81 | 82 | 92 | 93 | 94 | 103 | 104 | 119 | 120 | 121 | 130 | 131 | 146 | 147 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/color_pop_win.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 |