java - How to display count of received message on tab of viewpager with PagerSlidingTabStrip android? -
i building chat application. , in application using view pager pagerslidingtabstrip. below snapshot.
now want show numeric counter on recent's tab when ever received new message user
.
please me stuck on point many days.
thanks
i did custom view. edit pagerslidingtabstrip.java file below.
private void addicontab(final int position, int resid) { layoutinflater inflater = (layoutinflater)getcontext().getsystemservice(context.layout_inflater_service); view view = inflater.inflate(r.layout.image_tab, null); imagebutton tab = (imagebutton)view.findviewbyid(r.id.img_icon); tab.setimageresource(resid); addtab(position, view);
}
if use text tab, modify addtexttab() method.
and layout.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <imagebutton android:id="@+id/img_icon" android:layout_width="match_parent" android:layout_height="match_parent" android:contentdescription="@null" android:layout_centerinparent="true" android:background="@null" android:clickable="false" /> <textview android:id="@+id/tv_count" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="7dp" android:background="@drawable/bg_number" android:gravity="center" android:text="33" /> </relativelayout>
Comments
Post a Comment