android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
dialogTitle.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
Here you're replacing existing layout params of correct type AbsListView.LayoutParams
with more generic ViewGroup.LayoutParams
. Layout params type is that of the parent container of the view.
If you need to modify existing layout params, access them with getLayoutParams()
, modify it, and call requestLayout()
to notify that the layout has changed.
Example. Instead of
fooView.setLayoutParams(new LayoutParams(123, 456));
do
LayoutParams lp = fooView.getLayoutParams();
lp.width = 123;
lp.height = 456;
fooView.requestLayout();