I have an Android application (4.0.3+). It is essentially a file explorer with some custom functionality. I set the title every now and again to reflect the path the user is currently at. However, on some longer paths, the title tends to overflow, like this:
/ storage / sdcard0 / mypath / subd...
However, I'd rather have it the other way around:
...card0 / mypath / subdir / subsubdir
Is it possible (and if so, how) to know whether or not the text in the title bar is overflowing (I didn't see any related methods in Activity
apart from setTitle()
)? Also, is it possible to have the text overflowing on the left side instead of the right side?
((TextView) ((FrameLayout) ((LinearLayout) ((ViewGroup) getWindow()
.getDecorView()).getChildAt(0)).getChildAt(0)).getChildAt(0))
.setEllipsize(TextUtils.TruncateAt.START);
got it from android:set title bar in middle