Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. private void setActionBarTitleAsMarquee(){
  2. // Get Action Bar's title
  3. View v = getWindow().getDecorView();
  4. int resId = getResources().getIdentifier("action_bar_title", "id", "android");
  5. TextView title = (TextView) v.findViewById(resId);
  6.  
  7. // Set the ellipsize mode to MARQUEE and make it scroll only once
  8. title.setEllipsize(TextUtils.TruncateAt.MARQUEE);
  9. title.setMarqueeRepeatLimit(-1);
  10.  
  11. // In order to start strolling, it has to be focusable and focused
  12. title.setFocusable(true);
  13. title.setFocusableInTouchMode(true);
  14. title.requestFocus();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement