ImageView的自適應屬性

昨天在做一個Android界面時,發現圖片不論使用match-parent還是wrap-content都無法正確的填滿ImageView。

幾番嘗試之後,找到了一個可以解決這個問題的方法,原來ImageView是有一個自適應的屬性的,將其設爲true即可。

代碼如下:

<span style="font-family:SimSun;font-size:12px;">    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
</span><pre name="code" class="html"><span style="font-family:SimSun;font-size:12px;"><span style="white-space:pre">	</span>android:style="color:#ff6666;"</span>
<span style="font-family: SimSun;font-size:12px;">	</span><span style="font-family: SimSun;font-size:12px;">android:adjustViewBounds="true"</span>
<span style="font-family: SimSun;font-size:12px;">        android:src="@drawable/img_login_title" /></span>


效果如下:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章