我工作tabactivity。

我想出现如下tabcontent(的FrameLayout)我tabwidget。

我通过设置tabwiget标签属性作为

完成它
android:gravity="bottom"

但不能的FrameLayout与这些标签对齐。

<强>即突片在屏幕的底部示出并重叠的FrameLayout

该怎么做?如果一些高度值设置为FrameLayout里如果不是机器人的所有屏幕进行了优化。我能做什么?任何想法???

有帮助吗?

解决方案

,或只是使用自定义一个从: http://code.google.com/p/androidtabs/

它允许在底部卡

其他提示

Tab-Activity背后的基本概念如下:

<强> TabHost 为窗口视图中的容器。 这个对象保存两个孩子:一组选项卡的标签,用户点击来选择特定的标签,并显示该页面的内容的FrameLayout对象。

在单独的元件都采用这种容器对象,而不是设置在子元件本身值通常控制。

<强> TabWidget 显示表示父标签集合中的每个标签页的标签的列表。此插件的容器对象是TabHost。 当用户选择一个选项卡,该对象发送一个消息给容器,TabHost,告诉切换显示页面。容器TabHost用于添加标签,添加回调处理程序,并管理回调。

所以调整布局如下 -

<?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:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >
    </FrameLayout>

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="-3dip"
        android:layout_weight="0" >
    </TabWidget>
  </LinearLayout>

  </TabHost>

Android的例子来救援!

http://developer.android.com/resources/tutorials /views/hello-tabwidget.html

只需互换tabcontent和在res /布局/ main.xml中的选项卡:

   <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
   <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />        
   <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />

   </LinearLayout>

请检查下面的链接

有两种方式在一个选项卡活动的底部显示的选项卡。

1)使用相对布局  2)使用Layout_weight属性

HTTP://justkumar.blogspot。 COM / 2011/09 /翼片-AT-自下而上的tabactivity-by.html

检查此

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:id="@android:id/tabhost">
<LinearLayout android:id="@+id/LinearLayout01"
android:orientation="vertical" 
android:layout_height="fill_parent"
android:layout_width="fill_parent">

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_height="fill_parent"
android:layout_width="fill_parent">

    <TabWidget 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:layout_gravity="bottom" 
android:id="@android:id/tabs">
</TabWidget>
</FrameLayout>

</LinearLayout>

<强>这是对底部标签的代码

<TabWidget
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_gravity="bottom" 
android:background="#0000"
android:id="@android:id/tabs"
/>



  "android:layout_gravity="bottom" 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top