Search in sources :

Example 26 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class BigCache method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    final LinearLayout testBed = new LinearLayout(this);
    testBed.setOrientation(LinearLayout.VERTICAL);
    testBed.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    final int cacheSize = ViewConfiguration.getMaximumDrawingCacheSize();
    final Display display = getWindowManager().getDefaultDisplay();
    final int screenWidth = display.getWidth();
    final int screenHeight = display.getHeight();
    final View tiny = new View(this);
    tiny.setId(R.id.a);
    tiny.setBackgroundColor(0xFFFF0000);
    tiny.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, screenHeight));
    final View large = new View(this);
    large.setId(R.id.b);
    large.setBackgroundColor(0xFF00FF00);
    // Compute the height of the view assuming a cache size based on ARGB8888
    final int height = 2 * (cacheSize / 2) / screenWidth;
    large.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, height));
    final ScrollView scroller = new ScrollView(this);
    scroller.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    testBed.addView(tiny);
    testBed.addView(large);
    scroller.addView(testBed);
    setContentView(scroller);
}
Also used : ScrollView(android.widget.ScrollView) ViewGroup(android.view.ViewGroup) ScrollView(android.widget.ScrollView) View(android.view.View) LinearLayout(android.widget.LinearLayout) Display(android.view.Display)

Example 27 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class CreateViewTest method testLayout2.

@SmallTest
public void testLayout2() throws Exception {
    LinearLayout vert = new LinearLayout(mContext);
    vert.addView(new CreateViewTest.ViewOne(mContext), new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT, 0));
}
Also used : LinearLayout(android.widget.LinearLayout) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 28 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class Merge method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mLayout = new LinearLayout(this);
    mLayout.setOrientation(LinearLayout.VERTICAL);
    LayoutInflater.from(this).inflate(R.layout.merge_tag, mLayout);
    setContentView(mLayout);
}
Also used : LinearLayout(android.widget.LinearLayout)

Example 29 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class VerticalFocusSearch method addSkinny.

/**
     * Add a skinny button that takes up just less than half of the screen
     * horizontally.
     * @param root The layout to add the button to.
     * @param label The label of the button.
     * @param atRight Which side to put the button on.
     * @return The newly created button.
     */
private Button addSkinny(LinearLayout root, String label, boolean atRight) {
    Button button = new MyButton(this);
    button.setText(label);
    button.setLayoutParams(new LinearLayout.LayoutParams(// width
    0, ViewGroup.LayoutParams.WRAP_CONTENT, 480));
    TextView filler = new TextView(this);
    filler.setText("filler");
    filler.setLayoutParams(new LinearLayout.LayoutParams(// width
    0, ViewGroup.LayoutParams.WRAP_CONTENT, 520));
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.HORIZONTAL);
    ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    if (atRight) {
        ll.addView(filler);
        ll.addView(button);
        root.addView(ll);
    } else {
        ll.addView(button);
        ll.addView(filler);
        root.addView(ll);
    }
    return button;
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 30 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class VerticalFocusSearch method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mLayout = new LinearLayout(this);
    mLayout.setOrientation(LinearLayout.VERTICAL);
    mLayout.setHorizontalGravity(Gravity.START);
    mLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mTopWide = makeWide("top wide");
    mLayout.addView(mTopWide);
    mMidSkinny1Left = addSkinny(mLayout, "mid skinny 1(L)", false);
    mMidSkinny2Right = addSkinny(mLayout, "mid skinny 2(R)", true);
    mBottomWide = makeWide("bottom wide");
    mLayout.addView(mBottomWide);
    setContentView(mLayout);
}
Also used : ViewGroup(android.view.ViewGroup) LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1171 View (android.view.View)457 TextView (android.widget.TextView)435 ViewGroup (android.view.ViewGroup)200 ImageView (android.widget.ImageView)189 Button (android.widget.Button)164 ScrollView (android.widget.ScrollView)123 ListView (android.widget.ListView)97 LayoutInflater (android.view.LayoutInflater)86 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)74 AdapterView (android.widget.AdapterView)71 EditText (android.widget.EditText)69 Intent (android.content.Intent)58 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)45 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42