use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class CirclePropActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
ProgressBar spinner = new ProgressBar(this, null, android.R.attr.progressBarStyleLarge);
layout.addView(spinner, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
// For testing with a functor in the tree
// WebView wv = new WebView(this);
// wv.setWebViewClient(new WebViewClient());
// wv.setWebChromeClient(new WebChromeClient());
// wv.loadUrl("http://theverge.com");
// layout.addView(wv, new LayoutParams(LayoutParams.MATCH_PARENT, 100));
layout.addView(new CircleView(this), new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
setContentView(layout);
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class SurfaceAndTextureViews method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.surface_texture_views);
final ViewGroup container = (ViewGroup) findViewById(R.id.container);
Button toggleButton = (Button) findViewById(R.id.toggleButton);
mView = new SimpleView(this);
mView.setId(0);
mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
container.addView(mView);
mSurfaceView = new SimpleSurfaceView(this);
mSurfaceView.setId(1);
mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
container.addView(mSurfaceView);
mTextureView = new SimpleTextureView(this);
mTextureView.setId(2);
mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
container.addView(mTextureView);
final TransitionSet transition = new TransitionSet();
transition.addTransition(new ChangeBounds()).addTransition(new Crossfade().addTarget(0).addTarget(1).addTarget(2));
toggleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Scene newScene = new Scene(container);
newScene.setEnterAction(new Runnable() {
@Override
public void run() {
if (mView.getWidth() <= SMALL_SIZE) {
mView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
mView.mColor = SimpleView.LARGE_COLOR;
mSurfaceView.mColor = SimpleSurfaceView.LARGE_COLOR;
mTextureView.mColor = SimpleTextureView.LARGE_COLOR;
} else {
mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
mView.mColor = SimpleView.SMALL_COLOR;
mSurfaceView.mColor = SimpleSurfaceView.SMALL_COLOR;
mTextureView.mColor = SimpleTextureView.SMALL_COLOR;
}
}
});
TransitionManager.go(newScene, transition);
}
});
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by crdroidandroid.
the class GlyphCacheActivity method createTextView.
private TextView createTextView() {
TextView textview = new TextView(this);
textview.setTextSize(6 + (int) (Math.random() * 5) * 10);
textview.setTextColor(0xff << 24 | (int) (Math.random() * 255) << 16 | (int) (Math.random() * 255) << 8 | (int) (Math.random() * 255) << 16);
textview.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
int numChars = 5 + (int) (Math.random() * 10);
mTotalChars += numChars;
textview.setText(createString(numChars));
return textview;
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by crdroidandroid.
the class GlyphCacheActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScrollView scrollView = new ScrollView(this);
scrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
scrollView.addView(layout);
while (mTotalChars < 10000) {
layout.addView(createTextView());
}
setContentView(scrollView);
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by crdroidandroid.
the class RevealActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
ProgressBar spinner = new ProgressBar(this, null, android.R.attr.progressBarStyleLarge);
layout.addView(spinner, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
View revealView = new MyView(this);
layout.addView(revealView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
setContentView(layout);
revealView.setOnClickListener(this);
}
Aggregations