GridView with dynamic number of columns in each row

前端 未结 2 1627
予麋鹿
予麋鹿 2021-01-02 05:36

How can I recreate the following view with the help of a GridView.

\"enter

相关标签:
2条回答
  • I guess that this is not a single GridView but a combination of multiple Layouts. Just make a LinearLayout and decide according to the content, which layout you want to have in a row.

    0 讨论(0)
  • 2021-01-02 06:22

    To obtain the layout you see you can use something like this:

    <LinearLayout android:orientation="vertical">
        <!-- First row -->
        <View />
    
        <!-- Second row -->
        <LinearLayout android:orientation="horizontal" />
    
        <!-- Third row -->
        <LinearLayout android:orientation="horizontal" />
    
        <!-- Fourth row -->
        <View />
    
    </LinearLayout>
    

    If you want also the paged effect you can use a ViewPager

    http://android-developers.blogspot.it/2011/08/horizontal-view-swiping-with-viewpager.html

    0 讨论(0)
提交回复
热议问题