我正确使用了视图持有者/回收视图。列表视图本身设置为match_parent
我的自定义列表视图是平滑的,直到我给图像一个值。
Bitmap flagPic = BitmapFactory.decodeResource(this.mContext.getResources(),
R.drawable.afganistanicon);
holder.feedProfilePic.setImageBitmap(Bitmap.createScaledBitmap(flagPic, 100, 90, false));
问题可能在于我的列表行项目布局活动?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:id="@+id/feedThumbnailId"
android:padding="1dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true">
<ImageView
android:id="@+id/feedProfilePic"
android:background="@android:drawable/ic_menu_always_landscape_portrait"
android:layout_width="50dp"
android:layout_height="50dp" />
</LinearLayout>
<TextView
android:id="@+id/feedUsernameId"
android:text="username"
android:textColor="#282727"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:textSize="18sp"
android:layout_toRightOf="@id/feedThumbnailId"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/feedTextId"
android:layout_marginTop="10dp"
android:textSize="19sp"
android:textColor="#282727"
android:layout_marginLeft="6dp"
android:text="status"
android:layout_below="@+id/feedDownVoteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/feedDate"
android:text="x hours ago"
android:textColor="#282727"
android:layout_marginLeft="10dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/feedCommentButton"
android:layout_below="@+id/feedTextId"
android:layout_alignParentBottom="true"
android:layout_marginTop="30dp"
android:layout_centerHorizontal="true"
android:text="comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"/>
<TextView
android:id="@+id/feedRepliesNumId"
android:text="y replies"
android:textColor="#282727"
android:layout_toRightOf="@id/feedCommentButton"
android:layout_marginLeft="8dp"
android:layout_marginRight="10dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/feedNumofLikes"
android:text="x likes"
android:textColor="#282727"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/feedUpVoteButton"
android:text="Up"
android:layout_toLeftOf="@+id/feedNumofLikes"
android:layout_marginRight="6dp"
android:layout_width="55dp"
android:layout_marginTop="14dp"
android:layout_height="40dp"
android:focusable="false" />
<Button
android:id="@+id/feedDownVoteButton"
android:text="DW"
android:layout_below="@+id/feedUpVoteButton"
android:layout_toLeftOf="@+id/feedNumofLikes"
android:layout_marginRight="6dp"
android:layout_width="55dp"
android:layout_height="40dp"
android:focusable="false" />