我怎么能伸展在GridView的细胞垂直? [英] How can I stretch the cells of the GridView vertically?

查看:117
本文介绍了我怎么能伸展在GridView的细胞垂直?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的GridView的:

I have this GridView:

<GridView     android:id="@+id/gridEtebarSanji"
              android:layout_width="match_parent"
              android:layout_height="480dp"
              android:background="@color/black"
              android:gravity="center"
              android:horizontalSpacing="2dp"
              android:isScrollContainer="false"
              android:numColumns="3"
              android:stretchMode="columnWidth"
              android:verticalSpacing="2dp" >

  </GridView>

和该布局将用于它的内部的文件:

And this layout to be used for the item inside of it:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_horizontal" >

    <TextView
        android:id="@+id/tvText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:singleLine="false"
        android:text="TextView"
        android:textSize="16dip" />

</LinearLayout>

和结果:

欲伸展单线细胞是只要多行细胞。我该怎么做?

I want to stretch single line cells to be as long as multi-line cells. How can I do that?

我已经设置的android:layout_height =match_parent为textViews,但它不影响

I have set android:layout_height="match_parent" for textViews but it does not affect.

推荐答案

设置你的TextView显示2行:

Set your TextView to display 2 lines:

<TextView
        android:id="@+id/tvText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:lines="2"
        android:text="TextView"
        android:textSize="16dip" />

这篇关于我怎么能伸展在GridView的细胞垂直?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆