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);
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations