简体   繁体   English

选项卡下面的选项卡小部件文本

[英]tab widget text below the tab

i am new to android and had create the tabhost with two tabwidget all thing goes ok and fine and now i am displaying two different activity with two tab also.but the question is the text which i am specifying for two different tab is coming below while running the app.Below i am putting the screenshot for understanding 我是新来的android并用两个tabwidget创建了tabhost,一切顺利,现在我还显示了两个tab。两个不同的活动。但是问题是我为两个不同的tab指定的文本在下面,而运行应用程序。下面我将屏幕截图用于理解

Screenshot: 屏幕截图: 在此处输入图片说明

the text are mark as red so is there any way to align that text to the center. 文本标记为红色,因此有任何方法可以使文本与中心对齐。 one more thing im also using the drawable image for different state of user click. 另外,我还针对用户点击的不同状态使用了可绘制图像。 thanks for any help. 谢谢你的帮助。

the xml file for the tabhost Tabhost的xml文件

<?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:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <include layout="@layout/top_portion_layout"/>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAlignment="center"
           >
        </TabWidget>
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#808080">
            </FrameLayout>

    </LinearLayout>
</TabHost>

the portion is another layout which having two button sync all and home which i am including in this layout 该部分是另一个布局,它具有两个按钮,所有这些都同步,并且我将其包含在此布局中

inspite of 尽管

android:textAlignment="center"

you should use 你应该使用

android:gravity="center"
android:layout_gravity="center_vertical"

inside tab_host element 在tab_host元素内

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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