大佬教程收集整理的这篇文章主要介绍了android – TextView中的自动水平滚动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如果textView中的文本太长,我需要它自动滚动.
它是一行文本,需要水平滚动.@H_489_6@
TextView android:text="Single-line text view that scrolls automatically" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit ="marquee_forever" android:focusable="true" android:focusableInTouchMode="true" android:scrollHorizontally="true" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
它适用于我的测试应用程序,其中只有一个文本视图.
但它在我的画廊中不起作用.注意到,文字只是保持不动.@H_489_6@
有帮助吗?@H_489_6@
public class AutoScrollingTextView extends TextView { public AutoScrollingTextView(Context context,AttributeSet attrs,int defStylE) { super(context,attrs,defStylE); } public AutoScrollingTextView(Context context,AttributeSet attrs) { super(context,attrs); } public AutoScrollingTextView(Context context) { super(context); } @Override protected void onFocusChanged(Boolean focused,int direction,Rect prevIoUslyFocusedRect) { if (focused) { super.onFocusChanged(focused,direction,prevIoUslyFocusedRect); } } @Override public void onWindowFocusChanged(Boolean focused) { if (focused) { super.onWindowFocusChanged(focused); } } @Override public Boolean isFocused() { return true; } }
android:scrollHorizontally="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever"
以上是大佬教程为你收集整理的android – TextView中的自动水平滚动全部内容,希望文章能够帮你解决android – TextView中的自动水平滚动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。