I've been googling but failed enough.
this is the code snippet and result to what i currently have.
LinearLayout mLinear = (LinearLayout) inflater.inflate(R.layout.tab_layout, null);
TextView mTextView = (TextView) mLinear.findViewById(R.id.txt_title);
//mTextView.setLayoutParams(new LayoutParams(LayoutParams.))
mTextView.setGravity(Gravity.BOTTOM);
mTextView.setText("Update");
BadgeView mBadgeView = new BadgeView(this , mTextView);
mBadgeView.setText("2");
mBadgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
mBadgeView.show();
Tab updates = mActionBar.newTab();
updates.setCustomView(null);
updates.setCustomView(mLinear);
updates.setTabListener(tabListener);
mActionBar.addTab(updates);
heres what i really want.
is this possible for actionbarsherlock tabs?
You need to set the LayoutParams
of your LinearLayout to MATCH_PARENT
to make your custom view take up all the available space in the tab.
I wrote a blog post on the topic of adding a badge to a tab: http://kevinpelgrims.com/blog/2014/06/24/adding-a-badge-to-an-actionbar-tab