I try to write a xml like below xml,but always get an exception say
that"Caused by: java.lang.UnsupportedOperationException:
addView(View,LayoutParams) is not supported in Adapterview".
It is say that in layout xml can not use <ListView> </ListView>
,and
it should be <ListView />
and be manipulated using java code,is it?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<ListView android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00FF00"
android:layout_weight="1"
android:drawSelectorOnTop="false">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
android:text="No data"/>
</ListView>
</LinearLayout>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…