0
我的代碼是像下面,當從如何設置佈局包裹縮放內容
android:layout_height="wrap_content"
的FrameLayout裏layout_height到
android:layout_height="120dp"
佈局變得
我希望圖像的高度將變爲120dp,並保持規模。 然後佈局的寬度將隨之發生變化,如wrap_content, 所述,但它似乎只適應原始圖像的大小。
我該怎麼辦?
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_thumbnail_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/network_3" />
</FrameLayout>
哦,對不起我的錯。不是ImageView的android:layout_height,FrameLayout的android:layout_height。 我想,framelayout的高度是120dp,寬度是wrap,imageView的高度和寬度都匹配,然後,圖像高度將匹配到120dp,並縮放其寬度,最後framelayout將適合其寬度的imageview。 – GeminiYellow
編輯我的答案。 –
哦,不,它將FrameLayout的H&W固定。 但我希望只有FrameLayout的高度固定, 寬度跟ImageView。 – GeminiYellow