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

コードは、この Web リンク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 に答える