From 4ea6da2d0a135997a436fbccfd835de9e020061b Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 24 Mar 2020 11:19:22 +0800 Subject: [PATCH] feat:align android and iOS image's default scale type --- .../doric/src/main/java/pub/doric/shader/ImageNode.java | 4 +++- doric-iOS/Pod/Classes/Shader/DoricImageNode.m | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java b/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java index cccd57e6..94c07436 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java @@ -66,7 +66,9 @@ public class ImageNode extends ViewNode { @Override protected ImageView build() { - return new ImageView(getContext()); + ImageView imageView = new ImageView(getContext()); + imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); + return imageView; } @Override diff --git a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m index eb94ccc4..d939077d 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m @@ -39,6 +39,7 @@ @implementation DoricImageNode - (UIImageView *)build { return [[YYAnimatedImageView new] also:^(UIImageView *it) { it.clipsToBounds = YES; + it.contentMode = UIViewContentModeScaleAspectFill; }]; }