In vk, for example, long name and surname scroll in a circle, how to implement this?
1 answer
For example, using reflection, you can get and set the appropriate attributes for the TextView , which displays the title in the Toolbar :
TextView titleTextView = null; try { Field f = toolbar.getClass().getDeclaredField("mTitleTextView"); f.setAccessible(true); titleTextView = (TextView) f.get(toolbar); titleTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE); titleTextView.setFocusable(true); titleTextView.setFocusableInTouchMode(true); titleTextView.requestFocus(); titleTextView.setSingleLine(true); titleTextView.setSelected(true); titleTextView.setMarqueeRepeatLimit(-1); } catch (NoSuchFieldException e) { // some actions } catch (IllegalAccessException e) { // some actions } - Thanks It works. How to change the scroll speed? And reduce the scroll rate? - Nikita Doloshey
- @Nikidadolgoshey, I can not answer your questions, but something tells me that you need to dig very, very deeply, because these attributes are somewhere deep in the implementation of
TextView, or in the implementation ofTextUtils. - post_zeew - Okay, and thanks for that) - Nikita Doloshey
|