2

I'm using a custom titlebar created for my own use in the app i'm making, containing the title and some buttons. However occasionally I get titles that are slightly too long for the titlebar, where the titles are out of my control.

Currently setting the titlebar's height through "android:windowTitleSize="70dp"" in the titlebar's theme, but is there a way to dynamically change it if I can detect that the incoming title is too long and falls over into two lines?

1 Answers1

0

I didn't find a solution for this either.. but you could try android:ellipsize="end". This way if the text will flow out of the TextView's bounds, the text will be cut of at the end and "..." will be added to the text. Here is also the documentation.

Cata
  • 11,133
  • 11
  • 65
  • 86
  • I would have done so if it were any other text other than the title. Having a "..." in any titlebar makes me feel weird, like having a book title too long for the book. – user1667600 Oct 04 '12 at 06:40
  • you can use marquee also.. here is an example http://stackoverflow.com/questions/4344349/android-marquee but I don't recomend using two lines text on the app's title bar either – Cata Oct 04 '12 at 06:45
  • It is a move i'd take if im desperate enough; however then if i get a one line title instead of a multi line one i'd have too much space. Does not look good either. – user1667600 Oct 04 '12 at 06:55