use of android.widget.LinearLayout.LayoutParams in project platform_frameworks_base by android.
the class PowerTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(LOGTAG, "onCreate, inst=" + Integer.toHexString(hashCode()));
LinearLayout contentView = new LinearLayout(this);
contentView.setOrientation(LinearLayout.VERTICAL);
setContentView(contentView);
setTitle("Idle");
webView = new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
webViewClient = new SimpleWebViewClient();
chromeClient = new SimpleChromeClient();
webView.setWebViewClient(webViewClient);
webView.setWebChromeClient(chromeClient);
contentView.addView(webView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0f));
handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_TIMEOUT:
handleTimeout();
return;
case MSG_NAVIGATE:
manualDelay = msg.arg2;
navigate(msg.getData().getString(MSG_NAV_URL), msg.arg1);
logTime = msg.getData().getBoolean(MSG_NAV_LOGTIME);
return;
}
}
};
pageDoneLock = new Object();
}
use of android.widget.LinearLayout.LayoutParams in project twitterdroid by fbrunel.
the class StatusAdapter method makeUserStatusView.
// Create the view for each user status
// [FIXME] Should be put as an XML file (possible?)
private View makeUserStatusView(Context context, TwitterEntry entry) {
ImageView iv = new ImageView(context);
Bitmap photo = BitmapCache.getInstance().get(entry.getUser().getProfileImageURL());
iv.setImageBitmap(photo);
iv.setScaleType(ScaleType.CENTER);
iv.setPadding(0, 4, 4, 0);
iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
TextView tv = new TextView(context);
tv.setText(entry.getUser().getName() + ": " + entry.getText());
tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.HORIZONTAL);
layout.setPadding(4, 2, 4, 2);
layout.addView(iv);
layout.addView(tv);
return layout;
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by DirtyUnicorns.
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);
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by DirtyUnicorns.
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 DirtyUnicorns.
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);
}
});
}
Aggregations