开发者

How to flush the shown text in marquee?

I have created a marquee text using TextView in an开发者_运维知识库droid. My requirement is to flush the shown text in the marquee and append new text to it. How to flush the shown text?


@Hanry You are right but i think it will marquee only if it gains focus.. i had this problem earlier.. what i did is replaced the textview with webview and used marquee tag to make the text scroll.

Edit : Response to sangita

        webview = (WebView) findViewById(R.id.webview);
        webview.getSettings().setDefaultFontSize(26);
        webview.setBackgroundColor(R.color.Black);
        webview.setOnTouchListener(new OnTouchListener() {


            public boolean onTouch(View v, MotionEvent event) {
                //DO actions here
            }
        });
        String content = "MARQUEE TEST";

        String summary = "<html><FONT color='#fdb728' FACE='courier'><marquee behavior='scroll' direction='left' scrollamount=10>"
                + content + "</marquee></FONT></html>";
        webview.loadData(summary, "text/html", "utf-8");


You can use

setMarqueeRepeatLimit (int marqueeLimit)

set to 1 and add new text by appending new one DO this for each time you append new text and set to -1 when finished.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜