Search in sources :

Example 26 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.

the class HierarchicalMove method sendMessage.

public void sendMessage(View view) {
    TransitionManager.beginDelayedTransition(mSceneRoot, mTransition);
    int widthSpec = wide ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT;
    LayoutParams params = new LayoutParams(widthSpec, LayoutParams.WRAP_CONTENT);
    for (int i = 0; i < buttons.length; ++i) {
        buttons[i].setLayoutParams(params);
    }
    wide = !wide;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams)

Example 27 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.

the class CrossfadeMultiple method sendMessage.

public void sendMessage(View view) {
    TransitionManager.beginDelayedTransition(mSceneRoot, mTransition);
    int id = view.getId();
    LayoutParams params = null;
    switch(id) {
        case R.id.button1:
            params = new LayoutParams(200, 200);
            mButton.setText("A");
            mTextView.setText("1111111");
            mImageView.setImageResource(R.drawable.self_portrait_square_100);
            break;
        case R.id.button2:
            params = new LayoutParams(400, 200);
            mButton.setText("B");
            mTextView.setText("2222222");
            mImageView.setImageResource(R.drawable.self_portrait_square_200);
            break;
        case R.id.button3:
            params = new LayoutParams(200, 400);
            mButton.setText("C");
            mTextView.setText("3333333");
            mImageView.setImageResource(R.drawable.self_portrait_square_400);
            break;
    }
    mButton.setLayoutParams(params);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams)

Example 28 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.

the class DelayedTransition method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.two_buttons);
    final Button button1 = (Button) findViewById(R.id.button1);
    final Button button2 = (Button) findViewById(R.id.button2);
    final LinearLayout container = (LinearLayout) findViewById(R.id.container);
    button1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            int buttonWidth = button1.getWidth();
            int containerWidth = container.getWidth();
            if (buttonWidth < containerWidth) {
                TransitionManager.beginDelayedTransition(container, null);
                button1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
                TransitionManager.beginDelayedTransition(container, null);
                button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
            } else {
                TransitionManager.beginDelayedTransition(container, null);
                button1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                TransitionManager.beginDelayedTransition(container, null);
                button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            }
        }
    });
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Button(android.widget.Button) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 29 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.

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 30 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project QRCode by 5peak2me.

the class ResultActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);
    Bundle extras = getIntent().getExtras();
    mResultImage = (ImageView) findViewById(R.id.result_image);
    mResultText = (TextView) findViewById(R.id.result_text);
    if (null != extras) {
        int width = extras.getInt("width");
        int height = extras.getInt("height");
        LayoutParams lps = new LayoutParams(width, height);
        lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
        lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
        lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
        mResultImage.setLayoutParams(lps);
        String result = extras.getString("result");
        mResultText.setText(result);
        Bitmap barcode = null;
        byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
        if (compressedBitmap != null) {
            barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
            // Mutable copy:
            barcode = barcode.copy(Bitmap.Config.RGB_565, true);
        }
        mResultImage.setImageBitmap(barcode);
    }
}
Also used : Bitmap(android.graphics.Bitmap) LayoutParams(android.widget.LinearLayout.LayoutParams) Bundle(android.os.Bundle)

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