我已经看到一些关于这个的喋喋不休,但没有什么明确的.有没有办法将TabWidget中的标签放到屏幕底部?如果是这样,怎么样?
我尝试了以下,但没有奏效:
a)在tablayout下面设置tabwidget
b)将tabwidget的引力设置为"bottom"
谢谢!llappall
当此选项卡是当前选项卡时,我正试图找到能够在选项卡上触发onclick事件的方法.
我确实尝试过这种方式(在其他几种方式中)并没有成功.
public void onTabChanged(String tabId) {
Log.d(this.getClass().getName(), ">>>>>>>>>>>>>>>>>>>>>>>> tabId: " + tabId);
int tabs = getTabWidget().getChildCount();
Log.d(this.getClass().getName(), "tabs: " + tabs);
for(int i=0; i<tabs; i++){
View tab = getTabWidget().getChildAt(i);
if(i==tabHost.getCurrentTab()){
Log.d(this.getClass().getName(), "tab: " + i);
tab.setOnClickListener(this);
}else{
tab.setOnClickListener(null);
tab.getOnFocusChangeListener();
}
}
}
Run Code Online (Sandbox Code Playgroud)
关键是我设置为onClickListener,null所以下次单击选项卡时没有任何反应,但我希望有正常的选项卡行为.
外面有什么想法吗?
如何更改选项卡的字体大小?我为选项卡扩展了TabActivity.
如何更改选项卡文本指示器的颜色?我可以使用选择标签更改图标参考示例.但不能文字颜色.怎么样?
我有下一个布局的简单标签活动:
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff00" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff00" />
Run Code Online (Sandbox Code Playgroud)
我使用按钮作为标签的指示器
tabHost.addTab(tabHost.newTabSpec("Tab1")
.setIndicator(new Button(this))
.setContent(new Intent(this, TabActivity1.class)));
tabHost.addTab(tabHost.newTabSpec("Tab2")
.setIndicator(new Button(this))
.setContent(new Intent(this, TabActivity2.class)));
Run Code Online (Sandbox Code Playgroud)
在这种情况下,FrameLayout总是在顶部有黑线和阴影效果(你可以在按钮下看到它):

问题是:我怎样摆脱这条线?在Android源中绘制它的方法在哪里?
我的应用程序有一个带有四个选项卡的tabhost,现在我正在尝试为横向模式制作漂亮的布局.为了利用额外的水平空间,我想将TabWidget放在屏幕的右侧,而cource的所有标签必须在另一个之下(如列中).但是当切换到横向模式时,所有标签都会排成一行,看起来很难看.如何解决?

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1">
<include layout="@layout/filter_wizard"/>
<include layout="@layout/filter_wizard"/>
<include layout="@layout/filter_wizard"/>
<include layout="@layout/filter_wizard"/>
</FrameLayout>
<TabWidget
android:background="#75ffffff"
android:id="@android:id/tabs"
android:layout_width="wrap_content" android:orientation="vertical"
android:layout_height="fill_parent" android:layout_weight="0" />
</LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud) 我已经制作了一个应用程序,其中包含HelloTabActivity中的标签,这些标签之间也有空格,任何人都可以建议如何删除此空间,并且标签下方还有一条灰色线条如何删除?

main.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</HorizontalScrollView>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomTheme" parent="@android:style/Theme">
<item name="android:tabWidgetStyle">@style/CustomTabWidget</item>
</style>
<style name="CustomTabWidget" parent="@android:style/Widget.TabWidget">
<item name="android:textAppearance">@style/CustomTabWidgetText</item>
</style>
<style name="CustomTabWidgetText"
parent="@android:style/TextAppearance.Widget.TabWidget">
<item name="android:textSize">10sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#1589FF</item>
<item name="android:padding">3dip</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
活动
public class InfralineTabWidget extends TabActivity{
public void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud) android tabwidget android-layout android-style-tabhost android-tabhost
在Android 4.0中,我将标签栏与两个小部件放在一起.在代码中我写小alphabates(新)但在应用程序中它应该始终显示(新)如何在android 4.0中的选项卡上写小alphabates
我想创建一个ActionBar像谷歌+应用程序一样的标签式导航.
我用这个例子作为起点,现在我有一个很棒的动作栏:
我还包括一个ViewPager和一个TabHost有标签和滚动左/右碎片.
我需要的是在蜂窝之前显示版本中的后箭头.如果我设置getActionBar().setDisplayHomeAsUpEnabled(true),箭头将自动显示在版本> =蜂窝中.
我还想要的是谷歌+应用程序等标签.
这是我的标签栏看起来如何:
删除了死的ImageShack链接
......这就是我想要的:
删除了死的ImageShack链接
我找不到像那样的标签栏样式的任何示例.
我有一个TabWidget,独立于ÀctionBarFragmentTatHost` , in a.
我想自定义它的外观和感觉,TabWidget但我不明白.我的目的是更改文本颜色和选择器颜色,如图所示,我可以更改背景TabWidget.我不想TextView为标签使用自定义,因为标签必须具有Holo外观.

我试图给TabWidget它一个风格,但它不起作用.通过这种方式:
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@style/MyTabs"
/>
Run Code Online (Sandbox Code Playgroud)
和风格
<style name="MyTabs">
<item name="android:textColor">@color/white</item>
<item name="android:background">@drawable/tabs</item>
<item name="android:backgroundStacked">@color/red_action_bar</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我试过用theme.xml添加样式parent="android:Widget.Holo.TabWidget",但没有任何反应.