Search in sources :

Example 31 with LayoutParams

use of android.view.ViewGroup.LayoutParams in project platform_frameworks_base by android.

the class AlertController method setupContent.

protected void setupContent(ViewGroup contentPanel) {
    mScrollView = (ScrollView) contentPanel.findViewById(R.id.scrollView);
    mScrollView.setFocusable(false);
    // Special case for users that only want to display a String
    mMessageView = (TextView) contentPanel.findViewById(R.id.message);
    if (mMessageView == null) {
        return;
    }
    if (mMessage != null) {
        mMessageView.setText(mMessage);
    } else {
        mMessageView.setVisibility(View.GONE);
        mScrollView.removeView(mMessageView);
        if (mListView != null) {
            final ViewGroup scrollParent = (ViewGroup) mScrollView.getParent();
            final int childIndex = scrollParent.indexOfChild(mScrollView);
            scrollParent.removeViewAt(childIndex);
            scrollParent.addView(mListView, childIndex, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
        } else {
            contentPanel.setVisibility(View.GONE);
        }
    }
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) ViewGroup(android.view.ViewGroup)

Example 32 with LayoutParams

use of android.view.ViewGroup.LayoutParams in project platform_frameworks_base by android.

the class Dialog method dispatchPopulateAccessibilityEvent.

@Override
public boolean dispatchPopulateAccessibilityEvent(@NonNull AccessibilityEvent event) {
    event.setClassName(getClass().getName());
    event.setPackageName(mContext.getPackageName());
    LayoutParams params = getWindow().getAttributes();
    boolean isFullScreen = (params.width == LayoutParams.MATCH_PARENT) && (params.height == LayoutParams.MATCH_PARENT);
    event.setFullScreen(isFullScreen);
    return false;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams)

Example 33 with LayoutParams

use of android.view.ViewGroup.LayoutParams in project vlayout by alibaba.

the class AbstractFullFillLayoutHelper method getAllChildren.

protected int getAllChildren(View[] toFill, RecyclerView.Recycler recycler, LayoutStateWrapper layoutState, LayoutChunkResult result, LayoutManagerHelper helper) {
    final boolean layingOutInPrimaryDirection = layoutState.getItemDirection() == LayoutStateWrapper.ITEM_DIRECTION_TAIL;
    int count = 0;
    int firstPos = layingOutInPrimaryDirection ? getRange().getLower() : getRange().getUpper();
    final int curPos = layoutState.getCurrentPosition();
    if (layingOutInPrimaryDirection ? (curPos > firstPos) : (curPos > firstPos)) {
        // do ugly bug fix now
        Log.w(TAG, "Please handle strange order views carefully");
    }
    while (count < toFill.length) {
        if (isOutOfRange(layoutState.getCurrentPosition()))
            break;
        View view = nextView(recycler, layoutState, helper, result);
        if (view == null) {
            break;
        }
        toFill[count] = view;
        // normalize layout params
        LayoutParams layoutParams = view.getLayoutParams();
        if (layoutParams == null) {
            view.setLayoutParams(generateDefaultLayoutParams());
        } else if (!checkLayoutParams(layoutParams)) {
            view.setLayoutParams(generateLayoutParams(layoutParams));
        }
        count++;
    }
    if (count > 0 && !layingOutInPrimaryDirection) {
        // reverse array
        int s = 0, e = count - 1;
        while (s < e) {
            View temp = toFill[s];
            toFill[s] = toFill[e];
            toFill[e] = temp;
            s++;
            e--;
        }
    }
    return count;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 34 with LayoutParams

use of android.view.ViewGroup.LayoutParams in project android-tooltips by rharter.

the class ToolTip method makeView.

/**
     * Builds the tooltip view for display.  The callout arrow is
     * defined by <code>gravity</code>, but defaults to alignment
     * at 0, it's up to the caller to position it appropriately
     * @param context The context used to build the view.
     * @return The constructed view, with added arrow.
     */
public View makeView(Context context) {
    LinearLayout layout = new LinearLayout(context);
    // If the tooltip is above or below, we make is fill the view.
    if (Gravity.isVertical(mGravity)) {
        layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    }
    mPointerView = new ToolTipPointerView(context, mColor, mGravity);
    if (Gravity.isHorizontal(mGravity)) {
        mPointerView.setLayoutParams(new LayoutParams(mPointerSize, mPointerSize * 2));
        layout.setOrientation(LinearLayout.HORIZONTAL);
    } else {
        mPointerView.setLayoutParams(new LayoutParams(mPointerSize * 2, mPointerSize));
        layout.setOrientation(LinearLayout.VERTICAL);
    }
    // For right and bottom alignment, the arrow goes at the beginning
    if ((mGravity & Gravity.RIGHT) == Gravity.RIGHT || (mGravity & Gravity.BOTTOM) == Gravity.BOTTOM) {
        layout.addView(mPointerView);
    }
    layout.addView(mContentView.get());
    // For left or top alignment, the arrow goes at the end
    if ((mGravity & Gravity.LEFT) == Gravity.LEFT || (mGravity & Gravity.TOP) == Gravity.TOP) {
        layout.addView(mPointerView);
    }
    return layout;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) LinearLayout(android.widget.LinearLayout)

Example 35 with LayoutParams

use of android.view.ViewGroup.LayoutParams in project standup-timer by jwood.

the class ConfigureStandupTimer method createMeetingLengthSpinner.

private View createMeetingLengthSpinner() {
    meetingLengthSpinner = new Spinner(this);
    meetingLengthSpinner.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    meetingLengthSpinner.setPrompt(this.getString(R.string.length_of_meeting));
    ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(this, R.array.meeting_lengths, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    meetingLengthSpinner.setAdapter(adapter);
    meetingLengthSpinner.setSelection(getSpinnerPositionFromMeetingLength(meetingLength));
    meetingLengthEditText = null;
    return meetingLengthSpinner;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) Spinner(android.widget.Spinner)

Aggregations

LayoutParams (android.view.ViewGroup.LayoutParams)265 TextView (android.widget.TextView)56 View (android.view.View)50 ViewGroup (android.view.ViewGroup)50 FrameLayout (android.widget.FrameLayout)35 LinearLayout (android.widget.LinearLayout)33 ImageView (android.widget.ImageView)30 Test (org.junit.Test)26 Paint (android.graphics.Paint)22 ListView (android.widget.ListView)22 ScrollView (android.widget.ScrollView)22 Context (android.content.Context)19 MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)19 AdapterView (android.widget.AdapterView)17 RelativeLayout (android.widget.RelativeLayout)14 DisplayMetrics (android.util.DisplayMetrics)12 CheckedTextView (android.widget.CheckedTextView)12 Rect (android.graphics.Rect)9 ViewParent (android.view.ViewParent)9 TypedArray (android.content.res.TypedArray)8