0

大家好(尤其是 CommonsWare)

我正在尝试使用 CommonsWare 的 TouchListView。

当我打开应用程序时,列表项的移动工作并且看起来应该这样做,但是当我移动项目时,视图的大小会有所不同(认为大小与 simple_list_item_1 大致相同)。

我的行布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:ignoreGravity="@+id/icon">
   <ImageView android:id="@+id/icon"
              android:layout_alignParentLeft="true"
              android:layout_alignParentTop="true"
              android:layout_alignParentBottom="true"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/grabber"/>
   <TextView
         android:id="@+id/label"
         android:layout_width="fill_parent"
         android:paddingLeft="9dip"
         android:layout_height="wrap_content"
         android:layout_alignWithParentIfMissing="true"
         android:layout_toRightOf="@id/icon"
         android:layout_centerVertical="true"
         android:textSize="25dip"
         android:ellipsize="marquee"
         android:singleLine="true"/>
   <View
         android:id="@+id/groceryCheckedView"
         android:layout_centerVertical="true"
         android:visibility="gone"
         android:focusable="true"
         android:background="@color/black"
         android:layout_height="2dp"
         android:layout_width="fill_parent"/>
   <View
         android:id="@+id/grocerySeparatorView"
         android:background="@color/red"
         android:layout_height="1dp"
         android:layout_width="fill_parent"
         android:layout_alignParentBottom="true"/>
</RelativeLayout>

编辑

图片来说明

插图

4

1 回答 1

1

如果我不得不猜测,您没有正确设置您的(或可能)的normal_height属性。该属性需要设置为行的高度,这需要是一个固定值。您的行高基于,无法提前知道。TouchListViewexpanded_heightnormal_heightwrap_content

于 2012-02-10T13:11:53.480 回答