AnyLifeZLB / ScrollTextView

Android ScrollTextView. You can use it in advisement player,TV news show or airport metro information public system App. 🇨🇳Android 滚动字幕跑马灯,可是使用在广告机设备,电视广告位或其他在机场,地铁使用的信息发布系统App使用
548 stars 109 forks source link

不支持动态布局? #20

Closed LankyBin-lb closed 2 years ago

LankyBin-lb commented 4 years ago

不在XML里写布局,而是在actuvuty中动态布局: addTextView(String text, int x, int y, int width, int height):

LinearLayout frameLayout = new LinearLayout(mContext); frameLayout.setX(x); frameLayout.setY(y); frameLayout.setLayoutParams(new LayoutParams(width, height)); ScrollTextView scrollTextView = new ScrollTextView(mContext); scrollTextView.setX(x); scrollTextView.setY(y); scrollTextView.setScaleX(width); scrollTextView.setScaleY(height); // scrollTextView.setMinimumWidth(width); // scrollTextView.setMinimumHeight(height); scrollTextView.setScrollForever(true); scrollTextView.setSpeed(4); scrollTextView.setText(text); frameLayout.addView(scrollTextView); root_layout.addView(frameLayout); 走到.setText的时候回报空引用: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'float android.graphics.Paint.measureText(java.lang.String)' on a null object reference

AnyLifeZLB commented 2 years ago

我想是支持的,https://patents.google.com/patent/CN103336691A/zh 这个专利就包含这种方式