Android 안드로이드2014. 7. 28. 08:55

 FILL_PARENT와 MATCH_PARENT 는 무엇이 다를까?



/**

 * Special value for the height or width requested by a View.

 * FILL_PARENT means that the view wants to be as big as its parent,

 * minus the parent's padding, if any. This value is deprecated

 * starting in API Level 8 and replaced by {@link #MATCH_PARENT}.

 */

 @SuppressWarnings({"UnusedDeclaration"})

 @Deprecated

 public static final int FILL_PARENT = -1;



/**

 * Special value for the height or width requested by a View.

 * MATCH_PARENT means that the view wants to be as big as its parent,

 * minus the parent's padding, if any. Introduced in API Level 8.

 */

 public static final int MATCH_PARENT = -1;


 

FILL_PARENT와 MATCH_PARENT는 정의된 값이 -1로 같다.

FILL_PARENT는 API8 부터 deprecated가 된다. 하위 호환을 위해 FILL_PARENT가 남았있는 것이고 가독성과 일관성이 있는 MATCH_PARENT 가 앞으로 사용될 예정이다.

Posted by 코드버무려