use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class ScrollViewButtonsAndLabels method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.scrollview_linear_layout);
// estimated ratio to get enough buttons so a couple are off screen
int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
mNumGroups = screenHeight / 30;
mScrollView = (ScrollView) findViewById(R.id.scrollView);
mLinearLayout = (LinearLayout) findViewById(R.id.layout);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
for (int i = 0; i < mNumGroups; i++) {
// want button to be first and last
if (i > 0) {
TextView textView = new TextView(this);
textView.setText("Text View " + i);
mLinearLayout.addView(textView, p);
}
Button button = new Button(this);
button.setText("Button " + (i + 1));
mLinearLayout.addView(button, p);
}
}
use of android.widget.LinearLayout in project httpclient by pixmob.
the class Issue435 method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
TextView t = new TextView(this);
t.setText("Must be on a portrait device where the tabs are stacked. Stacked background will disappear when action mode is triggered.");
layout.addView(t);
Button b = new Button(this);
b.setText("Start ActionMode");
b.setOnClickListener(this);
layout.addView(b);
setContentView(layout);
ActionBar ab = getSupportActionBar();
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ab.addTab(ab.newTab().setText("One").setTabListener(this));
ab.addTab(ab.newTab().setText("One").setTabListener(this));
ab.addTab(ab.newTab().setText("One").setTabListener(this));
ab.setBackgroundDrawable(new GradientDrawable(TOP_BOTTOM, new int[] { 0xFF004400, 0xFF002200 }));
ab.setStackedBackgroundDrawable(new GradientDrawable(TOP_BOTTOM, new int[] { 0xFF440000, 0xFF220000 }));
}
use of android.widget.LinearLayout in project httpclient by pixmob.
the class MenuItemImpl method setActionView.
public MenuItem setActionView(int resId) {
final Context context = mMenu.getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
setActionView(inflater.inflate(resId, new LinearLayout(context), false));
return this;
}
use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class ManualActivity method buildSpinnerLayout.
private void buildSpinnerLayout() {
LinearLayout layout = (LinearLayout) findViewById(R.id.spinner_layout);
String[][] mapsStrings = DisplayModifier.getStrings();
mSpinners = new Spinner[mapsStrings.length];
int index = 0;
for (String[] spinnerValues : mapsStrings) {
mSpinners[index] = new DisplayModifierSpinner(index);
mSpinners[index].setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, spinnerValues));
layout.addView(mSpinners[index]);
index++;
}
Log.d(LOG_TAG, "created " + index + " spinners");
}
use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class DpiTestActivity method addLabelToRoot.
private void addLabelToRoot(LinearLayout root, String text) {
TextView label = new TextView(this);
label.setText(text);
root.addView(label, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
}
Aggregations