剖析這個需求,需要做到的要求:
1、給定最大高度、最大寬度;
2、在這個最大區域內,把圖片的一維縮放到最大值,保證圖片完整顯示在區域內。
轉化要求爲實現:ImageView
1、wrap_content寬高;
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2、設置最大寬高,adjustViewBounds設置纔有效;
android:maxHeight="@dimen/p44"
android:maxWidth="@dimen/p105"
android:adjustViewBounds="true"
3、習慣性保障完整顯示在區域內。
android:scaleType="fitCenter"