本文介绍了Android的:如何删除选定的选项卡高亮颜色和放大器;论TabWidget preSS亮点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我现在的工作与Android TabWidget。我建立这个TabWidget基于 http://mobileorchard.com/android-app-development-标签-活动/
我已经添加背景到TabWidget,
但显然选定的选项卡和pressed标签的亮点是始终可见,我不能把它关掉呢。

下面是图片(抱歉不能直接添加图像,因为仍然是一个福利局)。 :
1.默认选中的标签: http://postimage.org/image/9ryed6w5b/
2. pressed标签: http://postimage.org/image/gwg7m83en/

我要的是默认选中的标签颜色和pressed标签的颜色是不可见或关闭,因此图像背景将完全显示,不会被这些颜色。

任何反应将是AP preciated。谢谢:)

在code:

 公共无效的onCreate(包savedInstanceState){
        //隐藏标题栏
        BasicDisplaySettings.toggleTaskBar(EpolicyMainActivity.this,假);
        //显示状态栏
        BasicDisplaySettings.toggleStatusBar(EpolicyMainActivity.this,真正的);

        super.onCreate(savedInstanceState);
        的setContentView(R.layout.epolicy);
        TabHost tabHost =(TabHost)findViewById(R.id.tabHost);
        tabHost.setup();
        tabHost.getTabWidget()setBackgroundColor(0)。
        。tabHost.getTabWidget()setBackgroundResource(R.drawable.epolicy_menu_bar);

        则tabspec SPEC1 = tabHost.newTabSpec(标签1);
        spec1.setContent(R.id.tab1);
        spec1.setIndicator(,getResources()getDrawable(R.drawable.epolicy_menu_home));

        则tabspec spec2 = tabHost.newTabSpec(标签2);
        spec2.setContent(R.id.tab2);
        spec2.setIndicator(,getResources()getDrawable(R.drawable.epolicy_menu_nab));

        则tabspec spec3 = tabHost.newTabSpec(标签3);
        spec3.setContent(R.id.tab3);
        spec3.setIndicator(,getResources()getDrawable(R.drawable.epolicy_menu_contact));

        则tabspec spec4 = tabHost.newTabSpec(表4);
        spec4.setContent(R.id.tab4);
        spec4.setIndicator(,getResources()getDrawable(R.drawable.epolicy_menu_agen));


tabHost.addTab(SPEC1);
tabHost.addTab(spec2);
tabHost.addTab(spec3);
tabHost.addTab(spec4);
 

解决方案

我想补充这一点,最后的作品:

  tabHost.getTabWidget()getChildTabViewAt(0).setBackgroundDrawable(空)。
tabHost.getTabWidget()getChildTabViewAt(1).setBackgroundDrawable(空)。
tabHost.getTabWidget()getChildTabViewAt(2).setBackgroundDrawable(空)。
tabHost.getTabWidget()getChildTabViewAt(3).setBackgroundDrawable(空)。
tabHost.setCurrentTab(0);
 

I am now working with Android TabWidget.I build this TabWidget based on http://mobileorchard.com/android-app-development-tabbed-activities/
I've already add background to the TabWidget,
but apparently the highlight of selected tab and pressed tab is always visible and I cant turn it off yet.

Here is the picture (sorry cant directly add image because still a newb). :
1. default selected tab : http://postimage.org/image/9ryed6w5b/
2. on pressed tab : http://postimage.org/image/gwg7m83en/

What I want is the default selected tab color and on pressed tab color to be invisible or turned off, so the image background will fully shown, not blocked by those colors.

Any response will be appreciated. Thank you :)

the code:

public void onCreate(Bundle savedInstanceState) {
        //hide title bar
        BasicDisplaySettings.toggleTaskBar(EpolicyMainActivity.this, false);
        //show status bar
        BasicDisplaySettings.toggleStatusBar(EpolicyMainActivity.this, true);

        super.onCreate(savedInstanceState);
        setContentView(R.layout.epolicy);
        TabHost tabHost=(TabHost)findViewById(R.id.tabHost);
        tabHost.setup();
        tabHost.getTabWidget().setBackgroundColor(0);
        tabHost.getTabWidget().setBackgroundResource(R.drawable.epolicy_menu_bar);

        TabSpec spec1=tabHost.newTabSpec("Tab 1");
        spec1.setContent(R.id.tab1);
        spec1.setIndicator("",getResources().getDrawable(R.drawable.epolicy_menu_home));

        TabSpec spec2=tabHost.newTabSpec("Tab 2");
        spec2.setContent(R.id.tab2);
        spec2.setIndicator("",getResources().getDrawable(R.drawable.epolicy_menu_nab));

        TabSpec spec3=tabHost.newTabSpec("Tab 3");
        spec3.setContent(R.id.tab3);
        spec3.setIndicator("",getResources().getDrawable(R.drawable.epolicy_menu_contact));

        TabSpec spec4=tabHost.newTabSpec("Tab 4");
        spec4.setContent(R.id.tab4);
        spec4.setIndicator("",getResources().getDrawable(R.drawable.epolicy_menu_agen));


tabHost.addTab(spec1);
tabHost.addTab(spec2);
tabHost.addTab(spec3);
tabHost.addTab(spec4);
解决方案

I add this and finally works :

tabHost.getTabWidget().getChildTabViewAt(0).setBackgroundDrawable(null);
tabHost.getTabWidget().getChildTabViewAt(1).setBackgroundDrawable(null);
tabHost.getTabWidget().getChildTabViewAt(2).setBackgroundDrawable(null);
tabHost.getTabWidget().getChildTabViewAt(3).setBackgroundDrawable(null);
tabHost.setCurrentTab(0);

这篇关于Android的:如何删除选定的选项卡高亮颜色和放大器;论TabWidget preSS亮点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:27