我正在使用gridView,每个项目在页脚都有一个图像和一个TextView。
所有图像都具有相同的大小,因此我根据需要使用match_parent或wrap_content。
但屏幕上只显示一行半的项目,它滚动,这是完美的,但我想显示两个完整的行,然后滚动。
此外,当我在小型设备上运行应用程序时,只显示1行,我希望始终显示2行。
我试着使用这个example,但它对我无效,因为停止滚动。
下面是我的一些XML代码
<?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:
<?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>发布于 2016-01-26 02:28:33
我觉得你的图片尺寸很大。您可以查看是否支持多屏幕教程。尝试在小屏幕上使用小图像。
https://stackoverflow.com/questions/34998804
复制相似问题