Android – marquee using maxlines

How to use maxlines instead of singleline?

This is my textview:

<TextView
    android:text="bla bla bla bla bla bla"
    android:id="@+id/MarqueeText" 
    android:layout_width="30dp"
    android:layout_height="wrap_content" 
    android:singleLine="true"
    android:ellipsize="marquee" 
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true" 
    android:focusable="true" 
    android:focusableInTouchMode="true" 
    android:freezesText="true">

After my code.java, I set my textview:

TextView txtView=(TextView) findViewById(R.id.MarqueeText);
txtView.setSelected(true);

The problem is Android: single line is not recommended, so I have to use Android: maxlines instead of checkboxes. I can't use it

resolvent:

You can try this:

android:maxLength = "10"

or

After setting Android: maxlines = "1", you must also set inputtype. Therefore, setting your Android: inputtype = "text" should be a trick

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>