In this blog we will explain how to used Custom ActionBar layout in android.try this
...................................................................................................................................................................
final ActionBar abar = getActionBar(); //line under the actionbar
abar.setBackgroundDrawable(getResources().getDrawable(R.drawable.preview)); View viewActionBar = getLayoutInflater().inflate(R.layout.acttionbar_relative, null); //Center the textview in the ActionBar !
ActionBar.LayoutParams params = new ActionBar.LayoutParams( ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER); TextView textviewTitle = (TextView) viewActionBar.findViewById(R.id.actionbar_textview); textviewTitle.setText("BeginnerPoint"); textviewTitle.setTextSize(14); abar.setCustomView(viewActionBar, params); abar.setDisplayShowCustomEnabled(true); abar.setDisplayShowTitleEnabled(false); abar.setDisplayHomeAsUpEnabled(true); abar.setHomeButtonEnabled(true);...................................................................................................................................................................
0 comments