現(xiàn)在的需求是丸凭。ImageView最高20dp福扬。保持長(zhǎng)寬比。
用height=20惜犀,width=wrap_content是不能解決問(wèn)題的铛碑。這個(gè)時(shí)候就需要用到maxHeight
和adjustViewBounds
這兩個(gè)屬性了∷浣纾看下代碼:
<ImageView
android:id="@+id/iautos_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="20dp"
android:adjustViewBounds="true"
android:clickable="true"
android:src="@mipmap/iautos"/>
注意這里的width和height都是wrap_content