
androID:marqueeRepeatlimit="marquee_forever" androID:ellipsize="marquee" androID:singleline="true" androID:scrollHorizontally="true" androID:focusable="true" androID:focusableIntouchMode="true"
对于第一个文本视图它工作正常,但对于其他它不工作,如果有人为活动中的其他textvIEw做了那么请帮助我.
谢谢.
解决方法 使用TextVIEw扩展您的类非常容易,并覆盖以下方法package com.az.app;import androID.content.Context;import androID.graphics.Rect;import androID.util.AttributeSet;import androID.Widget.TextVIEw;public class ScrollingTextVIEw extends TextVIEw { public ScrollingTextVIEw(Context context,AttributeSet attrs,int defStyle) { super(context,attrs,defStyle); } public ScrollingTextVIEw(Context context,AttributeSet attrs) { super(context,attrs); } public ScrollingTextVIEw(Context context) { super(context); } // =========================================================== // Constants // =========================================================== // =========================================================== // FIElds // =========================================================== // =========================================================== // Constructors // =========================================================== // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== @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; } // =========================================================== // Methods // =========================================================== // =========================================================== // Inner and Anonymous Classes // ===========================================================} 并在您的XML中执行此 *** 作
<com.az.app.ScrollingTextVIEw androID:ID="@+ID/TextVIEw02" androID:layout_wIDth="140dp" androID:layout_height="wrap_content" androID:layout_centerVertical="true" androID:layout_toRightOf="@+ID/ImageVIEw01" androID:ellipsize="marquee" androID:focusable="true" androID:focusableIntouchMode="true" androID:marqueeRepeatlimit="marquee_forever" androID:scrollHorizontally="true" androID:singleline="true" androID:text="This is a really very very very very very long text " androID:textAppearance="?androID:attr/textAppearanceSmall" /> </relativeLayout><com.az.app.ScrollingTextVIEw androID:ID="@+ID/TextVIEw03" androID:layout_wIDth="140dp" androID:layout_height="wrap_content" androID:layout_centerVertical="true" androID:layout_toRightOf="@+ID/ImageVIEw01" androID:ellipsize="marquee" androID:focusable="true" androID:focusableIntouchMode="true" androID:marqueeRepeatlimit="marquee_forever" androID:scrollHorizontally="true" androID:singleline="true" androID:text="This is a really very very very very very long text " androID:textAppearance="?androID:attr/textAppearanceSmall" /> </relativeLayout>
现在所有的textvIEw都会滚动.
更新:请注意,没有androID:singleline =“true”它不起作用.与androID:maxlines =“1”一起使用它,虽然我们知道它已被弃用.
总结以上是内存溢出为你收集整理的Android多个textview选框全部内容,希望文章能够帮你解决Android多个textview选框所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)