I try to add a View to a ScrollView AND to a Layout (Linear or Relative doesn’t change anything) in the same controller
RelativeLayout header = (RelativeLayout)((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.frame_header, null);
mListView.addHeaderView(header);
mLayout.addView(header);
But when i do that, it crash with
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
Moreover, when i only assign my view to the listView OR to the Layout it works perfectly..
Anyone has an idea to solve my problem?
A
Viewcan only have one parent, so what you want is not possible.