简体   繁体   中英

how to set tab bar image in center of tab using android?

here is my code .I am newbie can someone please help me how can i display imageIcon in center just like test appear in center please let me know how can i customize tab bar image using android.

protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                ActionBar bar = getActionBar();
                  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
            bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
            String headerName[] = {"Info","Location","Discipline","Summary","Status", "Plus"};
            //int headerName[]={R.drawable.info,R.drawable.location,R.drawable.discipline,R.drawable.summary,R.drawable.status, R.drawable.plus};
            Log.i("log ", "1");
            for (int i=0; i < headerName.length; i++) {

                    Tab tab = bar.newTab();                        
                   // tab.setText(headerName[i]);
                 tab.setIcon(R.drawable.info);

                    tab.setTabListener(this);
                    bar.addTab(tab);
                    Log.i("log ", "" +i);
            }
    }

目前的输出

the final tab bar image should display above the Blue line of tab bar and as well as in center. the image should appear same as tab bar text appearing in screen please help me how can i make custom tab bar image?

文字标签栏

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM