Search in sources :

Example 16 with LayoutParams

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();
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Message(android.os.Message) Handler(android.os.Handler) WebView(android.webkit.WebView) LinearLayout(android.widget.LinearLayout)

Example 17 with LayoutParams

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

Example 18 with LayoutParams

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);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ProgressBar(android.widget.ProgressBar) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 19 with LayoutParams

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

Example 20 with LayoutParams

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);
        }
    });
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds) Scene(android.transition.Scene) SurfaceView(android.view.SurfaceView) TextureView(android.view.TextureView) View(android.view.View) Button(android.widget.Button) TransitionSet(android.transition.TransitionSet) Crossfade(android.transition.Crossfade)

Aggregations

LayoutParams (android.widget.LinearLayout.LayoutParams)78 LinearLayout (android.widget.LinearLayout)44 View (android.view.View)36 TextView (android.widget.TextView)24 ImageView (android.widget.ImageView)17 Button (android.widget.Button)16 ProgressBar (android.widget.ProgressBar)9 Message (android.os.Message)8 OnClickListener (android.view.View.OnClickListener)8 ScrollView (android.widget.ScrollView)7 Handler (android.os.Handler)6 ViewGroup (android.view.ViewGroup)6 WebView (android.webkit.WebView)6 HorizontalScrollView (android.widget.HorizontalScrollView)5 ChangeBounds (android.transition.ChangeBounds)4 Crossfade (android.transition.Crossfade)4 Scene (android.transition.Scene)4 TransitionSet (android.transition.TransitionSet)4 SurfaceView (android.view.SurfaceView)4 TextureView (android.view.TextureView)4