Hi I am developing android application. In my application I am using action bar. I want to make center align my title of window in action-bar. I know it is possible using xm
Unfortunally, SBerg413's way doesn't work for me.
my custom layout is
And all works perfect:
UPD: this activity i use like a parent for all my activities, that should have the action bar.
public class ActionBarCustomizationActivity extends ActionBarActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getSupportActionBar().setDisplayShowCustomEnabled(true);
LayoutInflater inflater = LayoutInflater.from(this);
View v = inflater.inflate(R.layout.custom_action_bar, null);
TextView titleTextView = (TextView) v.findViewById(R.id.custom_action_bar_title);
titleTextView.setText(this.getTitle());
titleTextView.setTypeface(App.getInstance().getActionBarTypeFace());
this.getSupportActionBar().setCustomView(v);
}
}