首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓GridView问题显示行

问安卓GridView问题显示行
EN

Stack Overflow用户
提问于 2016-01-26 01:41:18
回答 1查看 150关注 0票数 0

我正在使用gridView,每个项目在页脚都有一个图像和一个TextView。

所有图像都具有相同的大小,因此我根据需要使用match_parent或wrap_content。

但屏幕上只显示一行半的项目,它滚动,这是完美的,但我想显示两个完整的行,然后滚动。

此外,当我在小型设备上运行应用程序时,只显示1行,我希望始终显示2行。

我试着使用这个example,但它对我无效,因为停止滚动。

下面是我的一些XML代码

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_app">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/black"
    android:id="@+id/header"
    android:padding="10dp">
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/icon_back"
        android:src="@drawable/ic_back" />
</RelativeLayout>
<com.xetux.util.ExpandableHeightGridView
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:gravity="center"
    android:horizontalSpacing="15dp"
    android:isScrollContainer="true"
    android:numColumns="3"
    android:padding="10dp"
    android:id="@+id/family_grid_view"
    android:layout_below="@+id/header"
    android:verticalSpacing="15dp"/>
<!--<GridView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp"
    android:id="@+id/family_grid_view"
    android:horizontalSpacing="15dp"
    android:verticalSpacing="15dp"
    android:layout_below="@+id/header"
    android:numColumns="3"/>-->
</RelativeLayout>

和每一项XML:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/family_image"
    android:background="@drawable/bg_family">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/black_transparency"
        android:text="FAMILIA"
        android:gravity="center"
        android:id="@+id/family_name"
        android:padding="10dp"
        android:layout_alignParentBottom="true"
        android:textColor="@color/white"
        android:textSize="15sp"/>
</RelativeLayout>
EN

回答 1

Stack Overflow用户

发布于 2016-01-26 02:28:33

我觉得你的图片尺寸很大。您可以查看是否支持多屏幕教程。尝试在小屏幕上使用小图像。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34998804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档