Reputation: 1781
I don't know why scaleType not works for this ImageView. widthGrayBlock is correct, I checked it with black background. ImageView has correct width and height but image resource doesn't fit it. Thank you.
ImageView gray = new ImageView(mParentActivity);
gray.setScaleType(ImageView.ScaleType.FIT_XY);
gray.setAdjustViewBounds(true);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
widthGrayBlock, LayoutParams.WRAP_CONTENT);
params.setMargins(marginLeft, 0, 5, 0);
progressLayout.addView(gray, 1, params);
gray.setImageResource(R.drawable.schedule_bar_gray);
//gray.setBackgroundColor(Color.BLACK);
Upvotes: 1
Views: 2271
Reputation: 202
Try this in your xml
android:scaleType="fitXY"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
it's worked for me when i had a problem.
Upvotes: 1