Android的操作栏福尔摩斯标签图标,从资源的每个标签 [英] Android Action Bar Sherlock Tabs Icon for each tab from resources

查看:132
本文介绍了Android的操作栏福尔摩斯标签图标,从资源的每个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用例如,从操作栏福尔摩斯片段标签寻呼机。我所试图做的是为每个标签设置不同的图标图像。文本为每个标签是没有必要的,它可以被包括在图像文件中。有一个简单的解决这个问题。

I am using example from Action Bar Sherlock Fragment Tabs Pager. What I am trying to do is set different icon image for each tab. Text for each tab is not necessary, it can be included in image file. Is there a simple solution to this problem.

推荐答案

这是我做什么和作品。创建选项卡菜单,然后添加文本信息(不需要你的情况),打开片段和图标:

This is what I do and works. Create the tabs menu and add the text (no needed in your case), the fragment to open and the Icon:

ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(true);
Tab tab = actionBar.newTab()
     .setText("Tab title")
     .setTabListener(new ResultadosSorteosFragment())
     .setIcon(R.drawable.resultados_sorteos);

我的问题是,我想要把图片下的文字。
我希望你汇入作业需要什么

My problem is that I want to put the image under the text. I hope it´s what you need

这篇关于Android的操作栏福尔摩斯标签图标,从资源的每个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆