Monday, December 19, 2011

Android Tab Navigation Bar

Android Tab Navigation Bar  Example;

android tab host navigation bar  example  look like iphone navigation bar.

it's very usefull for page navigation very easyly and you can inside tabview GroupActivity.
adding tab to tab host;

  Drawable d = getResources().getDrawable(R.drawable.setting_onclick);
        ImageView img1 = new ImageView(this);
        img1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,    LayoutParams.FILL_PARENT));
        img1.setPadding(20, 10, 20, 10);
        img1.setImageDrawable(d);
        homeTabSpec.setIndicator(img1).setContent(mainActivity);
       
        d = getResources().getDrawable(R.drawable.setting_onclick);
        img1 = new ImageView(this);
        img1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        img1.setImageDrawable(d);
        img1.setPadding(20, 10, 20, 10);
        signinTabSpec.setIndicator(img1).setContent(mainActivity1);

       tabHost.addTab(homeTabSpec);
        tabHost.addTab(signinTabSpec);

style for onpress tab.
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_selected="false" android:drawable="@drawable/settingstrans"/>
   <item android:state_selected="true" android:drawable="@drawable/settings_onclick"  />
</selector>



dowload source code here

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...