Android -ClassCastException -для LayoutParams от LinearLayout до AbsListView

У меня есть адаптер списка, который я пытаюсь установить собственный XML для (item.xml )если я не использую инфляцию (для прямой идентификации текстового представления через контекст приложения ), это работает отлично.. но тогда мой список не может быть тематическим..

public View getView(int position, View convertView, ViewGroup parent) {
        //System.gc();
        TextView tv;

        LayoutInflater inflater = getLayoutInflater();

        View row = View.inflate(mContext,R.layout.item,null); //.inflate(R.layout.item, parent, false); doesnt work either..
        String id = null;
        if (convertView == null) {
            tv =  (TextView) row.findViewById(R.id.TextView01);;
        } else
            tv = (TextView) convertView;

[..]

в logcatя получаю это..

    07-15 19:45:51.710: ERROR/AndroidRuntime(20185): FATAL EXCEPTION: main
        java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
        at android.widget.ListView.setupChild(ListView.java:1827)
        at android.widget.ListView.makeAndAddView(ListView.java:1794)
        at android.widget.ListView.fillDown(ListView.java:688)

мой файл item.xml выглядит следующим образом:

<?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="fill_parent"
          android:paddingBottom="15px"
          android:background="#fff200"
          android:paddingTop="15px"
          android:paddingLeft="15px">

<TextView android:id="@+id/TextView01"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textSize="40px"
          android:textStyle="bold"
          android:layout_marginLeft="20px"
          android:textColor="#0099CC">
</TextView>
</LinearLayout>
16
задан Wingston Sharon 15 July 2012 в 16:14
поделиться