我正在尝试根据FrameLayout
a 设置 的宽度和高度Bitmap
,我所做的是在下面
Bitmap theBitmap = BitmapFactory.decodeFile(theFileImage.toString());
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(theBitmap.getWidth(), theBitmap.getHeight());
frame.setLayoutParams(lp);
image.setLayoutParams(lp);
image.setImageBitmap(theBitmap);
但我得到一个ClassCastException
.
我做错什么了?
编辑:
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams