Reputation: 851
Please is there a way to reduce the font size of Tab Indicator? Here is my code and the screen shot of the App in an emulator. I also tried to use an image instead of the text,but the image doesn't show up in the emulator. I cant add the image,said i need at least 10 reputation to do so.
public class Landing extends TabActivity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.landing);
// create the TabHost that will contain the Tabs
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec predict = tabHost.newTabSpec("First Tab");
TabSpec predictions = tabHost.newTabSpec("Second Tab");
TabSpec leaders = tabHost.newTabSpec("Third tab");
TabSpec blog = tabHost.newTabSpec("fourth tab");
predict.setIndicator("HOME ");
predict.setContent(new Intent(this,Home.class));
predictions.setIndicator("Predictions");
predictions.setContent(new Intent(this,Mypredictions.class));
leaders.setIndicator("Leaders");
leaders.setContent(new Intent(this,Leaders.class));
blog.setIndicator("Blog");
blog.setContent(new Intent(this,Blog.class));
tabHost.addTab(predict);
tabHost.addTab(predictions);
tabHost.addTab(leaders);
tabHost.addTab(blog);
}
}
Upvotes: 0
Views: 375
Reputation: 3645
There is. First, create a layout xml with this content:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:gravity="center"
android:textSize="12sp"
android:textColor="@color/granite" />
here you can set the text size.
Then in java inflate this layout and add it as a view for the tab's indicator:
TextView tv1 = (TextView) View.inflate(context, R.layout.tab_view, null);
tab1.setIndicator(tv1);
Upvotes: 1