0

カスタムアダプターでListViewを使用しています-各行は2つのTextViewで構成されています。水平方向に整列。私が直面している問題: 最初の行項目の上に空のスペースが表示されます。行ビューがリサイクルされるため、残ります。これが私のレイアウト XML のスニペットです。

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1.0">

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:dividerHeight="0.0dp"
        android:divider="@color/transparent"
        android:cacheColorHint="@color/transparent"
        android:listSelector="@color/transparent"
        android:scrollbars="none"/>

    <View
        android:layout_width="fill_parent"
        android:layout_height="10dp"
        android:background="@drawable/shadow_bottom"
        android:layout_alignParentBottom="true"/>
</RelativeLayout>

行項目のレイアウトは次のとおりです。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content">
   <MyTextView1
       android:id="@+id/text"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="Sample text"
       android:paddingLeft="20dp"
       android:paddingRight="10dp"/>
   <MyTextView2
       android:id="@+id/number"
       android:layout_width="15dp"
       android:layout_height="wrap_content"
       android:gravity="right"
       android:paddingLeft="2dp"
       android:paddingRight="3dp"
       android:textSize="11sp"
       android:text="num"
       android:background="@color/transparent"
       android:textColor="@color/number_dark" />
</RelativeLayout>

MyTextView1 は、Unicode テキスト (マラヤーラム語) を保持するためのカスタム テキストビューです。

スクリーン ショットを次に示します: http://i.imm.io/Z3CH.png 空のスペースが明るい灰色 (レイアウトの背景色) で表示されます。

スクロールすると、最初の行がリサイクルされると、空のスペースが残ります- http://i.imm.io/Z3Dd.png

この空のスペースを削除するにはどうすればよいですか?

4

1 に答える 1

-1

から左パディングを削除しますtextview
これが役立つことを願っています

于 2013-03-12T06:09:07.950 に答える