this may help you...
ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
RelativeLayout layout = new RelativeLayout(actionBar.getThemedContext());
layout.setBackgroundColor(Color.TRANSPARENT);
ImageView imageView = new ImageView(actionBar.getThemedContext());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
imageView.setLayoutParams(params);
imageView.setScaleType(ImageView.ScaleType.CENTER);
imageView.setImageResource(R.drawable.ic_launcher);
imageView.setId(0xFEED);
layout.addView(imageView);
TextView textView = new TextView(actionBar.getThemedContext());
String s = "<font size='10' color='#FFFFFF'>Mine</font><br></br>You";
textView.setText(Html.fromHtml(s));
StateListDrawable drawable = new StateListDrawable();
drawable.addState(new int[] { android.R.attr.state_pressed },new ColorDrawable(0xFF4887A2));
drawable.addState(new int[] { android.R.attr.state_enabled,android.R.attr.state_focused }, new ColorDrawable(Color.TRANSPARENT));
textView.setBackgroundDrawable(drawable);
textView.setClickable(true);
textView.setFocusable(true);
textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Clicked", Toast.LENGTH_SHORT).show();
}
});
params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.LEFT_OF, imageView.getId());
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
textView.setLayoutParams(params);
layout.addView(textView);
ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(
ActionBar.LayoutParams.MATCH_PARENT,
ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER_VERTICAL
| Gravity.LEFT);
layout.setLayoutParams(layoutParams);
actionBar.setCustomView(layout);