2013-06-19 34 views
0

我有一个工作任务来创建显示项目列表的视图,并且它由选项卡控制。列表顶部必须有一个显示图像的标题。标签需要位于标题图片下方。用户滚动标签时,标题图像向上移动,直至标题消失。选项卡绝对不应该出现在屏幕上,它们应始终粘贴在列表视图的顶部,以便用户在3个列表之间导航。热切实现Google+个人资料列表视图布局?

我在google +个人资料视图中发现了类似的内容。该图像显示了它应该如何的一个示例。剂量任何人都知道如何在Android上实现。 https://dl.dropboxusercontent.com/u/81459779/question.jpg

回答

0

检查Action Bar Sherlock。安装“ABS:Demos”应用程序并查找“Tab Navigation”示例并尝试使用它。

UPDATE

哦,我知道了...

所以,尽量用 “ABS:碎片” 的应用程序。这里有一个名为“Tabs”的例子。

如果你看到它的布局(fragment_tabs.xml),你可以看到每个部件。您可以将TabHost换成新的LinearLayout,然后在TabHost之上加上View

更改此:

<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <TabWidget 
     android:id="@android:id/tabs" 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0"/> 

    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="0dp" 
     android:layout_height="0dp" 
     android:layout_weight="0"/> 

    <FrameLayout 
     android:id="@+android:id/realtabcontent" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"/> 

</LinearLayout> 

这样的事情:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TextView 
     android:id="@+id/Hello" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="CHANGE ME FOR THE VIEW YOU WANT" /> 

    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <TabWidget 
       android:id="@android:id/tabs" 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="0"/> 

      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="0dp" 
       android:layout_height="0dp" 
       android:layout_weight="0"/> 

      <FrameLayout 
       android:id="@+android:id/realtabcontent" 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1"/> 

     </LinearLayout> 
    </TabHost> 

+0

泰快速的答案。我知道这个例子,它很容易实现。问题是我需要上面的标签图片标题和标签需要向上滚动,直到他们到达顶部,然后坚持在那里。 – MarkoMilos

+0

添加了更新。 –

+0

好吧,让我说,我把标签内容与一些项目列表视图。我想要达到的目标是:当用户滚动列表时,您命名为“为我所需的视图改变我”的textView应该离开屏幕。当用户一直向下滚动时,它应该回来。 – MarkoMilos

相关问题