2

我正在尝试省略活动的标题,有人可以告诉我该怎么做吗?

setTitle("My Title");
//when the text of the title gets too long, how can I use setEllipsize() here? how can I get the view Id of that title?
4

2 回答 2

0

试试这个: http: //it-ride.blogspot.pt/2010/07/android-title-marquee.html 有些人说它有效,有些人说它没有。

于 2012-06-15T22:11:28.310 回答
-1

该代码基于此网络链接 http://it-ride.blogspot.pt/2010/07/android-title-marquee.html

// make the title scroll!
         // find the title TextView
         TextView title = (TextView) findViewById(android.R.id.title);
         // set the ellipsize mode to MARQUEE and make it scroll only once

         title.setEllipsize(TruncateAt.MARQUEE);
         title.setMarqueeRepeatLimit(1);
         // in order to start strolling, it has to be focusable and focused
         title.setFocusable(true);
         title.setFocusableInTouchMode(true);
         title.requestFocus();

在此处输入图像描述

于 2012-06-15T22:27:37.787 回答