关于setLayoutParams的类型转换错误

wv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));

new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1)这个参数原来是告诉服wv的父视图,如何布局wv

如果父视图是FrameLayout,则要new FrameLayout.LayoutParams,其他类推可知

赋错布局类型将导致类型转换错误,谨记

你可能感兴趣的:(关于setLayoutParams的类型转换错误)