Textview Marquee Not Working

TextView Marquee not working

working now :)
Code attached below

<TextView
android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
android:id="@+id/MarqueeText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:paddingLeft="15dip"
android:paddingRight="15dip"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true">

Edit (on behalf of Adil Hussain):

textView.setSelected(true) needs to be set in code behind for this to work.

Android Textview marquee not working for first time

When you setSelected true to your textview at that time textview is not in a position to perform command so you can do it inside view.post so when it is active it will perform the operation.

Try this code inside your button

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tv.setVisibility(View.VISIBLE);
tv.post(new Runnable() {
@Override
public void run() {
tv.setSelected(true);
}
});
}
});

TextView android:ellipsize= marquee not working as expected

As @iDroid Explorer pointed out, posting and accepting the answer can be of help to someone else. Adapting from my reply to Tom's comment:

I found the solution to my problem. After some attempts I've realized
that the problem was the android:selectAllOnFocus="true" line (Read
@Tom's explanation for probabale reason). I just removed that line and now everything is working
very well, the text is complete and scrolling like desired when it is
too long for the containing view.

TextView with marquee is not working

Maybe your text length is not long enough to let the Marquee runs. In other words, the marquee only works when the text is away larger than its respective width/area. So, I recommend to try to set the android:layout_width to be, for an example, 200dp or even more. then try the marquee. I hope it helps.

TextView Marquee not working in android

Just do this way in ur activity as ur code is ok for that for simple textview marquee

TextView textview=(TextView)findViewById(R.id.lblTitle);
textview.setSelected(true);

and if u want to use marquee in listview in adapter than check answer given at Marquee in listview



Related Topics



Leave a reply



Submit