All view groups include a width and height (
layout_width
and layout_height
), and each view is required to define them. Many LayoutParams also include optional margins and borders.You can specify width and height with exact measurements, though you probably won't want to do this often. More often, you will use one of these constants to set the width or height:
- wrap_content tells your view to size itself to the dimensions required by its content
- fill_parent (renamed match_parent in API Level 8) tells your view to become as big as its parent view group will allow.
所以wrap_content會自動調整大小根據dimension
fill_parent則會盡可能的放大(盡可能與parent view一樣大)
所以如果要維持原圖的大小
需要設定這兩個參數
layout_width
layout_height
沒有留言:
張貼留言