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);
}
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));
}
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);
}
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;
}
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);
}
Aggregations