【发布时间】:2015-01-21 20:07:15
【问题描述】:
我正在使用 gridview 以图像的形式显示一组项目,并在其下方以 textview 作为标题。
项目集合的最终项目是独一无二的,因为它只有一个图像,没有文本视图(这可能是相关的)。
目前我发现,一旦创建了包含普通项目和仅图像项目的行,文本视图就会被截断。
我尝试设置项目的最小高度和高度,但它似乎根本不影响网格。
网格:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="@drawable/Background"
android:id="@+id/root_layout"
android:padding="10dip"
android:layout_height="match_parent">
<GridView
android:id="@+id/connection_grid"
android:listSelector="@android:color/transparent"
android:horizontalSpacing="25dip"
android:stretchMode="columnWidth"
android:verticalSpacing="25dip"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
网格项目:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp">
<FrameLayout
android:id="@+id/screencap_layout"
android:layout_height="wrap_content"
android:background="@drawable/RowBorderBackground"
android:layout_width="wrap_content"
android:padding="1dip"
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/connection_icon"
android:layout_width="200dip"
android:layout_height="147dip"
android:background="@drawable/grid_view_selector"
android:scaleType="centerCrop" />
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/devicetype_layout"
android:background="@drawable/RowBorderBackground"
android:layout_gravity="right|bottom"
android:layout_marginBottom="-2dip"
android:layout_marginRight="-2dip"
android:padding="2dip">
<TextView
android:text="NA"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/device_type" />
</RelativeLayout>
</FrameLayout>
<TextView
android:id="@+id/connection_name"
android:text="Machine 1"
android:gravity="center"
android:textSize="18dip"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
【问题讨论】: