A message reminder in tabhost
res\drawable\shapecount.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="20dp" /> <solid android:color="#ff2233" /> </shape>
res\layout\tab_indicator.xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="0dip"android:layout_height="64dip"android:layout_weight="1"android:orientation="vertical"android:background="@drawable/tab_indicator"android:padding="5dp"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="20" android:textSize="12dp" android:textStyle="bold" android:background="@drawable/shapecount" android:textColor="#FFFFFF" android:paddingLeft="3dp" android:paddingRight="3dp" android:layout_margin="0dp" android:id="@+id/txtCount" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" style="?android:attr/tabWidgetStyle" /> </RelativeLayout>
in java code:
TabHost.TabSpec tSpecGames = tHost.newTabSpec("games"); View tabGamesIndicator = LayoutInflater.from(this).inflate( R.layout.tab_indicator, tHost.getTabWidget(), false); ((TextView) tabGamesIndicator.findViewById(R.id.title)) .setText(getString(R.string.gameTitle)); ((ImageView) tabGamesIndicator.findViewById(R.id.icon)) .setImageResource(R.drawable.ic_launcher); gameMessageNum=(TextView)tabGamesIndicator.findViewById(R.id.txtCount); tSpecGames.setIndicator(tabGamesIndicator); tSpecGames.setContent(new DummyTabContent(getBaseContext())); tHost.addTab(tSpecGames);
You must Sign up as a member of Effecthub to view the content.
Latest Posts
- Android: CookieManager removeAllCookie() Crash
- XlistView: A listview which can pull to refresh and load more (1)
- Millions of Android Phones Could Be Affected by the Heartbleed Bug. Check to See if Yours Is One of Them
- TOP 10 ANDROID GAMES FOR MARCH 2014
- Android:Button with different textcolor and background in different states
1844 views 1 comments
You must Sign up as a member of Effecthub to join the conversation.