ビットマップをImageViewに設定した後、幅と高さの両方にwrap_contentを設定したいと思います。
imgSubsegment = (ImageView) findViewById(R.id.subsegment);
ViewGroup.LayoutParams imageViewParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
......................................
imgSubsegmentSensor.setImageBitmap(bmpSubsegmentSensor);
imgSubsegmentSensor.setLayoutParams(imageViewParams);
与えているjava.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.view.ViewGroup$MarginLayoutParams
私のコードの問題は何ですか?の解き方?