Search in sources :

Example 21 with LayoutParams

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

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 22 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 23 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 24 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project FlycoDialog_Master by H07000223.

the class ActionSheetDialog method setUiBeforShow.

@Override
public void setUiBeforShow() {
    /** title */
    float radius = dp2px(mCornerRadius);
    mTvTitle.setHeight(dp2px(mTitleHeight));
    mTvTitle.setBackgroundDrawable(CornerUtils.cornerDrawable(mTitleBgColor, new float[] { radius, radius, radius, radius, 0, 0, 0, 0 }));
    mTvTitle.setText(mTitle);
    mTvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleTextSize);
    mTvTitle.setTextColor(mTitleTextColor);
    mTvTitle.setVisibility(mIsTitleShow ? View.VISIBLE : View.GONE);
    /** title underline */
    mVLineTitle.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, dp2px(mDividerHeight)));
    mVLineTitle.setBackgroundColor(mDividerColor);
    mVLineTitle.setVisibility(mIsTitleShow ? View.VISIBLE : View.GONE);
    /** mCancel btn */
    mTvCancel.setHeight(dp2px(mItemHeight));
    mTvCancel.setText(mCancelText);
    mTvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, mCancelTextSize);
    mTvCancel.setTextColor(mCancelTextColor);
    mTvCancel.setBackgroundDrawable(CornerUtils.listItemSelector(radius, mLvBgColor, mItemPressColor, 1, 0));
    mTvCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    /** listview */
    mLv.setDivider(new ColorDrawable(mDividerColor));
    mLv.setDividerHeight(dp2px(mDividerHeight));
    if (mIsTitleShow) {
        mLv.setBackgroundDrawable(CornerUtils.cornerDrawable(mLvBgColor, new float[] { 0, 0, 0, 0, radius, radius, radius, radius }));
    } else {
        mLv.setBackgroundDrawable(CornerUtils.cornerDrawable(mLvBgColor, radius));
    }
    if (mAdapter == null) {
        mAdapter = new ListDialogAdapter();
    }
    mLv.setAdapter(mAdapter);
    mLv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (mOnOperItemClickL != null) {
                mOnOperItemClickL.onOperItemClick(parent, view, position, id);
            }
        }
    });
    mLv.setLayoutAnimation(mLac);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ColorDrawable(android.graphics.drawable.ColorDrawable) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 25 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project GridListViewAdapters by birajpatel.

the class BaseGridAdapter method addNewCardsInRow.

/**
     * Adds the new cards in a new RowView by calling {@link #getNewCard(int)}
     * for each card.
     *
     * @param rowView         the row view
     * @param rowViewHolder   the row view holder
     * @param totalCardsInRow the total cards in row
     */
private void addNewCardsInRow(LinearLayout rowView, RowViewHolder<CVH> rowViewHolder, int totalCardsInRow) {
    int cardwidth = getCardWidth(totalCardsInRow);
    LinearLayout.LayoutParams layoutParams = null;
    CVH cardViewHolder = null;
    for (int positionInRow = 0; positionInRow < totalCardsInRow; positionInRow++) {
        boolean isLastCardInaRow = positionInRow == (totalCardsInRow - 1);
        Card<CVH> card = getNewCard(cardwidth);
        View cardView = card.getCardView();
        cardView.setTag(positionInRow);
        layoutParams = getCardLayoutParams(cardwidth, isLastCardInaRow);
        rowView.addView(cardView, layoutParams);
        cardViewHolder = card.getCardViewHolder();
        rowViewHolder.getCardViewHolders().add(cardViewHolder);
        registerChildrenViewClickEvents(cardViewHolder, childViewsClickHandler);
    }
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) View(android.view.View) SuppressLint(android.annotation.SuppressLint) LinearLayout(android.widget.LinearLayout)

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