我正在尝试根据Bitmap
设置FrameLayout
的宽度和高度,我所做的是:
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