1

I want to change menu item align to the right. With bellow code, change it to the center but I don't know how to change it to gen right align. There is no Layout.Alignment.ALIGN_RIGHT, how can I handle it?

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
     getMenuInflater().inflate(R.menu.home, menu);

     int possition=0;
     MenuItem item= menu.getItem(possition);
    SpannableString s=new SpannableString(item.getTitle());
     s.setSpan(new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER),0,s.length(),0);
     item.setTitle(s);

     return true;
 }
motevalizadeh
  • 5,244
  • 14
  • 61
  • 108
  • this should help you -->> https://stackoverflow.com/questions/36517082/right-to-left-menu-items-android – Wini Sep 10 '20 at 07:35

0 Answers0