下面是我想删除:
我如何更换显示器,以显示其标签当前显示以及蓝线跨越整个tabwidget?
How do I replace the indicator showing which tab is currently shown as well as the blue line that spans the entire tabwidget?
要指定:我只想说明选择哪个选项卡是这样的:
To Specify: All I want indicating which tab is selected is this :
tab_button_active.9.png应显示为背景如果该选项卡中选择 tab_button_inactive.9.png应显示为背景,如果标签没有被选中。编辑:设置tabStripEnabled为false不起作用。添加的样式,并具有:作为家长也不可能因为即时通讯目标定位API 7级和动作条在API级别11开始实施@android风格/ Widget.Holo.ActionBar
edit : Setting tabStripEnabled to false has no effect. Adding a style to it and having "@android:style/Widget.Holo.ActionBar" as its parent is also not possible since im targetting API level 7 and the ActionBar was implemented in API level 11.
推荐答案
如果安卓tabStripEnabled =假
没有工作,然后我也假设调用 setStripEnabled(布尔stripEnabled)
将没有任何效果为好。如果这一切都是真的,那么你的问题可能不是在TabWidget。
If android:tabStripEnabled="false"
did not work then I also assume calling setStripEnabled(boolean stripEnabled)
will have no effect as well. If all of this is true then your problem is probably not in TabWidget.
我会建议看你的标签指示。试试这些修改。这code取自有标签的片段。
I would suggest looking at your tab indicator. Try these modifications. This code is taken from a fragment that has tabs.
下面是code创建的标签指示视图。
Here is the code that creates the tab indicator view.
View indicator = LayoutInflater.from(getActivity()).inflate(R.layout.tab,
(ViewGroup) mRoot.findViewById(android.R.id.tabs), false);
TabSpec tabSpec = mTabHost.newTabSpec(tag);
tabSpec.setIndicator(indicator);
tabSpec.setContent(tabContentId);
您标签指标来看有可能希望与此类似。
Your tab indicator view would probably like similar to this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@drawable/tabselector"
android:padding="5dp" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tab1icon"/>
</LinearLayout>
现在这里的重要组成部分,是安卓背景=@可绘制/ tabselector
中的LinearLayout。我的是这样。
Now the important part here is the android:background="@drawable/tabselector"
in the LinearLayout. Mine looks like this.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item
android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/tab_unselected_light" />
<item
android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_selected_light" />
<!-- Focused states -->
<item
android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_focused_light" />
<!-- Pressed state -->
<item
android:state_pressed="true"
android:drawable="@drawable/tab_pressed_light" />
</selector>
这tabselector.xml在这里,您将交换 @绘制/ tab_ pressed_light
您 @绘制/ tab_button_active
和 @绘制/ tab_unselected_light
与 @绘制/ tab_button_inactive
This tabselector.xml is where you will swap @drawable/tab_pressed_light
with your @drawable/tab_button_active
and @drawable/tab_unselected_light
with @drawable/tab_button_inactive
请务必检查所有的可绘制的是进入你的tabselector.xml没有蓝条沿底部。当我看着你的形象,我可以看到小5像素的差距沿着这条这是给我的想法,即带是不是从你的TabWidget。希望这有助于。
Be sure to check that all of your drawables that go into your tabselector.xml do not have the blue strips along the bottom. As I look at your image I can see little 5px gaps along that strip this is what gave me the idea that the strip was not from your TabWidget. Hope this helps.
相关推荐
最新文章