Search code examples
javaandroidbuttonmarquee

Button Marquee Stops Once Title Bar Goes (help)


When placing this into Manifest.xml

 android:theme="@android:style/Theme.NoTitleBar"

It stops the marquee of my button

                newBut = new Button(this);  
                newBut.setText("("SOME REAL LONG TEXT SOME REAL LONG TEXT");
                newBut.setTextColor(Color.parseColor("#FFFFFF"));

                newBut.setEllipsize(TruncateAt.MARQUEE);
                newBut.setSingleLine();
                newBut.setMarqueeRepeatLimit(50);
                newBut.setSelected(true);

Once removed it marquees again..

Any thoughts on why this is and how I can get full screen and marquee buttons.


Solution

  • Problem with Marquee is lost focus. Try below code.

    newBut = new Button(this);  
    newBut.setFocusable(true);
    newBut.setFocusableInTouchMode(true);
    newBut.requestFocus();
    newBut.setText("("SOME REAL LONG TEXT SOME REAL LONG TEXT");
    newBut.setTextColor(Color.parseColor("#FFFFFF"));
    newBut.setEllipsize(TruncateAt.MARQUEE);
    newBut.setSingleLine();
    newBut.setMarqueeRepeatLimit(50);
    newBut.setSelected(true);