2013-01-10 24 views

回答

0

我不知道他们使用的到底是什么,但你可以实现与无论是GridLayoutListView同样的效果。

+0

我不认为这是可能的与列表视图 –

+0

当然是 - 您可以在ListView中具有不同的项目类型。您可以显示一个只显示一个项目的视图和一个显示两个项目并交替显示的视图。 –

1

简单足以与LinearLayout中做到这一点:

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <!-- Stack rows vertically --> 
    <LinearLayout android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
    <!-- First row, two items --> 
    <LinearLayout android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
     <!-- First item, 50% of width --> 
     <FooView android:id="@+id/foo1" 
      android:layout_width="0px" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" > 
     <!-- Second item, 50% of width --> 
     <FooView android:id="@+id/foo2" 
      android:layout_width="0px" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" > 
    </LinearLayout> 
    <!-- Next row, just one item --> 
    <LinearLayout android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
     <!-- Third item, 100% of width --> 
     <FooView android:id="@+id/foo2" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" > 
    </LinearLayout> 
    <!-- And so on... --> 
    </LinearLayout> 
</ScrollView> 

显然, “FooView” 的确切性质是你的,因为是装饰性边框,阴影等。实际上,您希望以编程方式执行此操作,但此静态xml布局会显示您所追求的内容。

GridLayout也可以工作,但它只能在4.0及以上版本中使用,除非您想开始使用兼容性库。由于LinearLayout将完成这项工作,这就是我将要使用的。 RelativeLayout可能也会起作用,但是我自己从来没有能够让这个该死的东西工作。