Search in sources :

Example 51 with LinearLayout

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);
    }
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 52 with LinearLayout

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 }));
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) ActionBar(com.actionbarsherlock.app.ActionBar) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 53 with LinearLayout

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;
}
Also used : Context(android.content.Context) LayoutInflater(android.view.LayoutInflater) LinearLayout(android.widget.LinearLayout)

Example 54 with LinearLayout

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");
}
Also used : LinearLayout(android.widget.LinearLayout)

Example 55 with LinearLayout

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));
}
Also used : TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1205 View (android.view.View)473 TextView (android.widget.TextView)455 ViewGroup (android.view.ViewGroup)203 ImageView (android.widget.ImageView)196 Button (android.widget.Button)167 ScrollView (android.widget.ScrollView)125 ListView (android.widget.ListView)100 LayoutInflater (android.view.LayoutInflater)90 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)80 AdapterView (android.widget.AdapterView)74 EditText (android.widget.EditText)74 Intent (android.content.Intent)66 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)46 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42