Android2.2中match_parent和fill_parent是一個意思

標題裏已經把這個意思表達清楚了,兩個參數意思一樣,只是某大牛覺得match_parent更貼切,於是從2.2開始你兩個詞都可以用。那麼如果考慮低版本的使用情況你就需要用fill_parent了。

下面是兩者相同的證據,看android.view.ViewGroup裏的靜態嵌套類LayoutParams中的代碼:

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;

/**
* Special value for the height or width requested by a View.
* WRAP_CONTENT means that the view wants to be just large enough to fit
* its own internal content, taking its own padding into account.
*/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章