Deprecate fill_parent and introduce match_parent.

Bug: #2361749.
This commit is contained in:
Romain Guy
2010-01-08 15:05:33 -08:00
parent b4e39aebf6
commit 74192eafec
243 changed files with 1003 additions and 1015 deletions

View File

@@ -24,7 +24,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ViewGroup.MarginLayoutParams;
import android.widget.AbsListView;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListAdapter;
@@ -112,7 +111,7 @@ public class ExpandableList1 extends ExpandableListActivity {
public TextView getGenericView() {
// Layout parameters for the ExpandableListView
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, 64);
ViewGroup.LayoutParams.MATCH_PARENT, 64);
TextView textView = new TextView(ExpandableList1.this);
textView.setLayoutParams(lp);

View File

@@ -67,8 +67,8 @@ public class ImageSwitcher1 extends Activity implements
ImageView i = new ImageView(this);
i.setBackgroundColor(0xFF000000);
i.setScaleType(ImageView.ScaleType.FIT_CENTER);
i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
return i;
}

View File

@@ -46,11 +46,11 @@ public class InternalSelectionFocus extends Activity {
final LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.HORIZONTAL);
layout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,
ViewGroup.LayoutParams.FILL_PARENT, 1);
ViewGroup.LayoutParams.MATCH_PARENT, 1);
final InternalSelectionView leftColumn = new InternalSelectionView(this, 5, "left column");
leftColumn.setLayoutParams(params);

View File

@@ -44,7 +44,7 @@ public class InternalSelectionScroll extends Activity {
ScrollView sv = new ScrollView(this);
ViewGroup.LayoutParams svLp = new ScrollView.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
LinearLayout ll = new LinearLayout(this);
@@ -54,7 +54,7 @@ public class InternalSelectionScroll extends Activity {
InternalSelectionView isv = new InternalSelectionView(this, 10);
int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
2 * screenHeight); // 2x screen height to ensure scrolling
isv.setLayoutParams(llLp);
ll.addView(isv);

View File

@@ -25,7 +25,7 @@ import android.os.Bundle;
/**
* Demonstrates using fill_parent within a linear layout whose size is not fixed.
* Demonstrates using match_parent within a linear layout whose size is not fixed.
*
*/
public class LinearLayout7 extends Activity {

View File

@@ -346,12 +346,12 @@ public class List4 extends ListActivity {
mTitle = new TextView(context);
mTitle.setText(title);
addView(mTitle, new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
mDialogue = new TextView(context);
mDialogue.setText(words);
addView(mDialogue, new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
/**

View File

@@ -374,11 +374,11 @@ public class List6 extends ListActivity
mTitle = new TextView(context);
mTitle.setText(title);
addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
mDialogue = new TextView(context);
mDialogue.setText(dialogue);
addView(mDialogue, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
addView(mDialogue, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
mDialogue.setVisibility(expanded ? VISIBLE : GONE);
}

View File

@@ -20,7 +20,6 @@ import com.example.android.apis.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Button;
@@ -41,7 +40,7 @@ public class ScrollView2 extends Activity {
TextView textView = new TextView(this);
textView.setText("Text View " + i);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
layout.addView(textView, p);

View File

@@ -13,7 +13,7 @@
<dd>Demonstrates a simple LinearLayout, with child width set to WRAP_CONTENT. </dd>
<dt><a href="LinearLayout2.html">2. Vertical (Fill Screen)</a></dt>
<dd>Demonstrates a simple LinearLayout, with child width set to FILL_PARENT.</dd>
<dd>Demonstrates a simple LinearLayout, with child width set to MATCH_PARENT.</dd>
<dt><a href="LinearLayout3.html">3. Vertical (Padded)</a></dt>
<dd>Demonstrates a LinearLayout where one of the elements can expand to fill any remaining screen space (weight=1). </dd>
@@ -25,7 +25,7 @@
<dd>Demonstrates nested layouts to create a user form.</dd>
<dt><a href="LinearLayout6.html">6. Uniform Size</a></dt>
<dd>LinearLayout which uses a combination of wrap_content on itself and fill_parent on its children to get every item to be the same width.</dd>
<dd>LinearLayout which uses a combination of wrap_content on itself and match_parent on its children to get every item to be the same width.</dd>
<dt><a href="LinearLayout7.html">7. Fill Parent</a></dt>
<dd>Demonstrates a horizontal linear layout with equally sized columns. Some columns force their height to match the parent.</dd>