开发者

How to include Multiple GridView in a Activity(use ScrollView), just displayed one row?

开发者 https://www.devze.com 2023-02-12 03:31 出处:网络
I want to make Activity like this using GridView. And this Activity have only one scrollbar include all text & gridview.

I want to make Activity like this using GridView. And this Activity have only one scrollbar include all text & gridview.

for it, using scrollview.

<ScrollView>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
  开发者_运维知识库android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
/>
<GridView
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
/>
<TextView
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
/>
<GridView
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
/>
</LinearLayout>
</ScrollView>

I wrote xml and class like attached using ScrollView to have only one scroll. GridView has android:layout_height="fill_parent", but just visible one row. And each GridView has scroll. Same result layout_height was changed to wrap_content.

Is it bug? or Do I have some mistake? or Is it impossible? Thanks.


You need to use the parameter weight : 0 for TextView 1 for GridView

0

精彩评论

暂无评论...
验证码 换一张
取 消