所以我对listview有一个相当讨厌的问题.我的应用程序工作得很好,直到我的Droid 2上的Android 2.3.3更新.(似乎在三星Evo上工作正常)
这个问题有几个方面.1.空插槽中的背景始终为灰色.2.列表中的最后一个条目在被选中之前似乎是不可见的.选中后,您可以看到黑色文本,但没有背景.3.列表中的其他/旧条目显示正确的背景颜色.
我已经尝试了很多东西,似乎没有什么能解决这个问题.思考?
Listview定义
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:gravity="left|center"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:paddingLeft="1px">
<TextView android:text=""
android:id="@+id/list_view_text_view"
android:layout_width="wrap_content"
android:textSize="13sp"
android:singleLine="false"
android:layout_height="wrap_content"
android:layout_marginLeft="1sp">
</TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
listview的主要布局
<ListView android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignRight="@+id/Button06"
android:layout_below="@+id/TextView01"
android:layout_alignLeft="@+id/TextView01"
android:layout_marginBottom="2sp"
android:layout_marginRight="2sp"
android:layout_marginLeft="2sp"
android:layout_above="@+id/EditText01"
android:transcriptMode="normal"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:gravity="bottom"
>
</ListView>
Run Code Online (Sandbox Code Playgroud)
Listveiw适配器
private class EfficientAdapter extends BaseAdapter {
private LayoutInflater mInflater;
public EfficientAdapter(Context context) {
mInflater = LayoutInflater.from(context);
}
public int getCount() {
return comment_list.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int …Run Code Online (Sandbox Code Playgroud)