本文整理汇总了Java中android.support.v4.view.MarginLayoutParamsCompat.getMarginEnd方法的典型用法代码示例。如果您正苦于以下问题:Java MarginLayoutParamsCompat.getMarginEnd方法的具体用法?Java MarginLayoutParamsCompat.getMarginEnd怎么用?Java MarginLayoutParamsCompat.getMarginEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.MarginLayoutParamsCompat
的用法示例。
在下文中一共展示了MarginLayoutParamsCompat.getMarginEnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromFlexView
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
public static FlexItem fromFlexView(View view, int index) {
FlexboxLayout.LayoutParams lp = (FlexboxLayout.LayoutParams) view.getLayoutParams();
FlexItem flexItem = new FlexItem();
flexItem.index = index;
flexItem.order = lp.order;
flexItem.flexGrow = lp.flexGrow;
flexItem.flexShrink = lp.flexShrink;
flexItem.alignSelf = lp.alignSelf;
flexItem.flexBasisPercent = lp.flexBasisPercent;
flexItem.width = Util.pixelToDp(view.getContext(), lp.width);
flexItem.height = Util.pixelToDp(view.getContext(), lp.height);
flexItem.topMargin = lp.topMargin;
flexItem.startMargin = MarginLayoutParamsCompat.getMarginStart(lp);
flexItem.endMargin = MarginLayoutParamsCompat.getMarginEnd(lp);
flexItem.bottomMargin = lp.bottomMargin;
flexItem.paddingTop = view.getPaddingTop();
flexItem.paddingStart = ViewCompat.getPaddingStart(view);
flexItem.paddingEnd = ViewCompat.getPaddingEnd(view);
flexItem.paddingBottom = view.getPaddingBottom();
return flexItem;
}
示例2: getMarginEnd
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginEnd(View v) {
if (v == null) {
return 0;
}
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginEnd(lp);
}
示例3: getMarginHorizontally
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginHorizontally(View v) {
if (v == null) {
return 0;
}
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(lp) + MarginLayoutParamsCompat.getMarginEnd(lp);
}
示例4: getMarginHorizontally
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginHorizontally(View v) {
if (v == null) {
return 0;
}
MarginLayoutParams lp = (MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(lp) + MarginLayoutParamsCompat
.getMarginEnd(lp);
}
示例5: getMarginEnd
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginEnd(View v)
{
if (v == null)
{
return 0;
}
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginEnd(lp);
}
示例6: getMarginHorizontally
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginHorizontally(View v)
{
if (v == null)
{
return 0;
}
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(lp) + MarginLayoutParamsCompat.getMarginEnd(lp);
}
示例7: onLayout
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
if (isCompactMode())
{
int i9 = getHeight() - getPaddingBottom();
this.mHeader.layout(0, i9 - this.mHeader.getMeasuredHeight(), this.mHeader.getMeasuredWidth(), i9);
return;
}
int i = getWidth();
if (ViewCompat.getLayoutDirection(this) == 0) {}
for (boolean bool = true;; bool = false)
{
int j = getPaddingTop();
int k = getPaddingTop();
int m = this.mHeader.getMeasuredHeight();
if (this.mSubheader.getVisibility() != 8) {
m += this.mSubheader.getMeasuredHeight();
}
int n = j + (getHeight() - j - m - k) / 2;
int i1 = this.mHeader.getMeasuredWidth();
int i2 = PlayUtils.getViewLeftFromParentStart(i, i1, bool, 0);
this.mHeader.layout(i2, n, i2 + i1, n + this.mHeader.getMeasuredHeight());
int i3 = MarginLayoutParamsCompat.getMarginEnd((ViewGroup.MarginLayoutParams)this.mPlaylistControl.getLayoutParams());
int i4 = PlayUtils.getViewLeftFromParentEnd(i, this.mPlaylistControl.getMeasuredWidth(), bool, i3);
int i5 = n + this.mHeader.getBaseline() - this.mPlaylistControl.getBaseline();
this.mPlaylistControl.layout(i4, i5, i4 + this.mPlaylistControl.getMeasuredWidth(), i5 + this.mPlaylistControl.getMeasuredHeight());
if (this.mSubheader.getVisibility() == 8) {
break;
}
int i6 = this.mHeader.getBottom();
int i7 = this.mSubheader.getMeasuredWidth();
int i8 = PlayUtils.getViewLeftFromParentStart(i, i7, bool, 0);
this.mSubheader.layout(i8, i6, i8 + i7, i6 + this.mSubheader.getMeasuredHeight());
return;
}
}
示例8: onLayout
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
public void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
if (ViewCompat.getLayoutDirection(this) == 0) {}
for (boolean bool = true;; bool = false)
{
int i = getWidth();
int j = getHeight();
int k = getPaddingTop();
int m = ViewCompat.getPaddingStart(this);
if (this.mHeaderImage.getVisibility() != 8)
{
int i6 = this.mHeaderImage.getMeasuredWidth();
int i7 = this.mHeaderImage.getMeasuredHeight();
int i8 = k + (j - i7 - k) / 2;
int i9 = PlayUtils.getViewLeftFromParentStart(i, i6, bool, m);
this.mHeaderImage.layout(i9, i8, i9 + i6, i8 + i7);
m += i6 + MarginLayoutParamsCompat.getMarginEnd((ViewGroup.MarginLayoutParams)this.mHeaderImage.getLayoutParams());
}
int n = this.mTitleGroup.getMeasuredWidth();
int i1 = PlayUtils.getViewLeftFromParentStart(i, n, bool, m);
this.mTitleGroup.layout(i1, k, i1 + n, j);
if (this.mMoreView.getVisibility() != 8)
{
int i2 = this.mMoreView.getMeasuredWidth();
int i3 = this.mMoreView.getMeasuredHeight();
int i4 = k + (j - i3 - k) / 2;
int i5 = PlayUtils.getViewLeftFromParentEnd(i, i2, bool, ViewCompat.getPaddingEnd(this));
this.mMoreView.layout(i5, i4, i5 + i2, i4 + i3);
}
return;
}
}
示例9: onLayout
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
boolean bool;
int i;
int j;
int k;
if (ViewCompat.getLayoutDirection(this) == 0)
{
bool = true;
i = ViewCompat.getPaddingStart(this);
j = getPaddingTop();
k = getWidth();
if (this.mLinkIcon.getVisibility() != 0) {
break label205;
}
}
label205:
for (int m = 1;; m = 0)
{
int n = i;
if (m != 0)
{
ViewGroup.MarginLayoutParams localMarginLayoutParams = (ViewGroup.MarginLayoutParams)this.mLinkIcon.getLayoutParams();
int i3 = this.mLinkIcon.getMeasuredWidth();
int i4 = MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams);
int i5 = MarginLayoutParamsCompat.getMarginEnd(localMarginLayoutParams);
int i6 = j + localMarginLayoutParams.topMargin;
int i7 = PlayUtils.getViewLeftFromParentStart(k, i3, bool, i + i4);
this.mLinkIcon.layout(i7, i6, i7 + i3, i6 + this.mLinkIcon.getMeasuredHeight());
n += i5 + (i4 + i3);
}
int i1 = this.mLinkText.getMeasuredWidth();
int i2 = PlayUtils.getViewLeftFromParentStart(k, i1, bool, n);
this.mLinkText.layout(i2, j, i2 + i1, j + this.mLinkText.getMeasuredHeight());
return;
bool = false;
break;
}
}
示例10: layoutSingleChildVertical
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
/**
* Place a single View when the layout direction is vertical ({@link #mFlexDirection} is
* either {@link #FLEX_DIRECTION_COLUMN} or {@link #FLEX_DIRECTION_COLUMN_REVERSE}).
*
* @param view the View to be placed
* @param flexLine the {@link FlexLine} where the View belongs to
* @param isRtl {@code true} if the layout direction is right to left, {@code false}
* otherwise
* @param alignItems the align items attribute of this FlexboxLayout
* @param left the left position of the flex line where the View belongs to. The actual
* View's left position is shifted depending on the isRtl and alignItems
* attributes
* @param top the top position of the View, which the View's margin is already taken
* into account
* @param right the right position of the flex line where the View belongs to. The actual
* View's right position is shifted depending on the isRtl and alignItems
* attributes
* @param bottom the bottom position of the View, which the View's margin is already taken
* into account
* @see #getAlignItems()
* @see #setAlignItems(int)
* @see LayoutParams#alignSelf
*/
private void layoutSingleChildVertical(View view, FlexLine flexLine, boolean isRtl,
int alignItems, int left, int top, int right, int bottom) {
LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (lp.alignSelf != LayoutParams.ALIGN_SELF_AUTO) {
// Expecting the values for alignItems and alignSelf match except for ALIGN_SELF_AUTO.
// Assigning the alignSelf value as alignItems should work.
alignItems = lp.alignSelf;
}
int crossSize = flexLine.mCrossSize;
switch (alignItems) {
case ALIGN_ITEMS_FLEX_START: // Intentional fall through
case ALIGN_ITEMS_STRETCH: // Intentional fall through
case ALIGN_ITEMS_BASELINE:
if (!isRtl) {
view.layout(left + lp.leftMargin, top, right + lp.leftMargin, bottom);
} else {
view.layout(left - lp.rightMargin, top, right - lp.rightMargin, bottom);
}
break;
case ALIGN_ITEMS_FLEX_END:
if (!isRtl) {
view.layout(left + crossSize - view.getMeasuredWidth() - lp.rightMargin,
top, right + crossSize - view.getMeasuredWidth() - lp.rightMargin,
bottom);
} else {
// If the flexWrap == FLEX_WRAP_WRAP_REVERSE, the direction of the
// flexEnd is flipped (from left to right).
view.layout(left - crossSize + view.getMeasuredWidth() + lp.leftMargin, top,
right - crossSize + view.getMeasuredWidth() + lp.leftMargin,
bottom);
}
break;
case ALIGN_ITEMS_CENTER:
int leftFromCrossAxis = (crossSize - view.getMeasuredWidth()
+ MarginLayoutParamsCompat.getMarginStart(lp)
- MarginLayoutParamsCompat.getMarginEnd(lp)) / 2;
if (!isRtl) {
view.layout(left + leftFromCrossAxis, top, right + leftFromCrossAxis, bottom);
} else {
view.layout(left - leftFromCrossAxis, top, right - leftFromCrossAxis, bottom);
}
break;
}
}
示例11: getMarginEnd
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginEnd(View v) {
if (v == null) {
return 0;
}
return MarginLayoutParamsCompat.getMarginEnd((MarginLayoutParams) v.getLayoutParams());
}
示例12: getHorizontalMargins
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
private int getHorizontalMargins(View v) {
MarginLayoutParams mlp = (MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(mlp) + MarginLayoutParamsCompat.getMarginEnd(mlp);
}
示例13: updateTextAndIcon
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
private void updateTextAndIcon(
@Nullable final TextView textView, @Nullable final ImageView iconView) {
final Drawable icon =
(tab != null && tab.getIcon() != null)
? DrawableCompat.wrap(tab.getIcon()).mutate()
: null;
final CharSequence text = tab != null ? tab.getText() : null;
final CharSequence contentDesc = tab != null ? tab.getContentDescription() : null;
if (iconView != null) {
if (icon != null) {
DrawableCompat.setTintList(icon, tabIconTint);
if (tabIconTintMode != null) {
DrawableCompat.setTintMode(icon, tabIconTintMode);
}
iconView.setImageDrawable(icon);
iconView.setVisibility(VISIBLE);
setVisibility(VISIBLE);
} else {
iconView.setVisibility(GONE);
iconView.setImageDrawable(null);
}
iconView.setContentDescription(contentDesc);
}
final boolean hasText = !TextUtils.isEmpty(text);
if (textView != null) {
if (hasText) {
textView.setText(text);
textView.setVisibility(VISIBLE);
setVisibility(VISIBLE);
} else {
textView.setVisibility(GONE);
textView.setText(null);
}
textView.setContentDescription(contentDesc);
}
if (iconView != null) {
MarginLayoutParams lp = ((MarginLayoutParams) iconView.getLayoutParams());
int iconMargin = 0;
if (hasText && iconView.getVisibility() == VISIBLE) {
// If we're showing both text and icon, add some margin bottom to the icon
iconMargin = dpToPx(DEFAULT_GAP_TEXT_ICON);
}
if (inlineLabel) {
if (iconMargin != MarginLayoutParamsCompat.getMarginEnd(lp)) {
MarginLayoutParamsCompat.setMarginEnd(lp, iconMargin);
lp.bottomMargin = 0;
// Calls resolveLayoutParams(), necessary for layout direction
iconView.setLayoutParams(lp);
iconView.requestLayout();
}
} else {
if (iconMargin != lp.bottomMargin) {
lp.bottomMargin = iconMargin;
MarginLayoutParamsCompat.setMarginEnd(lp, 0);
// Calls resolveLayoutParams(), necessary for layout direction
iconView.setLayoutParams(lp);
iconView.requestLayout();
}
}
}
TooltipCompat.setTooltipText(this, hasText ? null : contentDesc);
}
示例14: onLayout
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
protected final void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
if (ViewCompat.getLayoutDirection(this) == 0) {}
int i;
int j;
int k;
int m;
int n;
int i1;
for (boolean bool = true;; bool = false)
{
i = getPaddingTop();
j = getPaddingBottom();
k = getHeight();
m = getWidth();
n = getChildCount();
i1 = 0;
for (int i2 = 0; i2 < n; i2++)
{
View localView2 = getChildAt(i2);
if (localView2.getVisibility() != 8) {
i1 = Math.max(i1, localView2.getBaseline());
}
}
}
int i3 = ViewCompat.getPaddingStart(this);
int i4 = 0;
if (i4 < n)
{
View localView1 = getChildAt(i4);
int i5;
int i6;
ViewGroup.MarginLayoutParams localMarginLayoutParams;
int i7;
if (localView1.getVisibility() != 8)
{
i5 = localView1.getMeasuredWidth();
i6 = localView1.getMeasuredHeight();
localMarginLayoutParams = (ViewGroup.MarginLayoutParams)localView1.getLayoutParams();
i7 = i3 + MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams);
if (!isCenteredVertically(localView1)) {
break label243;
}
}
label243:
for (int i8 = i + (k - i - j - i6) / 2;; i8 = i + i1 - localView1.getBaseline())
{
int i9 = PlayUtils.getViewLeftFromParentStart(m, i5, bool, i7);
localView1.layout(i9, i8, i9 + i5, i8 + localView1.getMeasuredHeight());
i3 = i7 + (i5 + MarginLayoutParamsCompat.getMarginEnd(localMarginLayoutParams));
i4++;
break;
}
}
}
示例15: onMeasure
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
protected final void onMeasure(int paramInt1, int paramInt2)
{
int i = View.MeasureSpec.getSize(paramInt1);
int j = i - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this);
int k = getChildCount();
int m = 0;
for (int n = 0; n < k; n++)
{
View localView2 = getChildAt(n);
if (localView2.getVisibility() != 8)
{
localView2.measure(0, 0);
if (!isCenteredVertically(localView2)) {
m = Math.max(m, localView2.getBaseline());
}
}
}
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
if (i4 < k)
{
View localView1 = getChildAt(i4);
int i7;
if (localView1.getVisibility() != 8)
{
i7 = localView1.getMeasuredHeight();
if (!isCenteredVertically(localView1)) {
break label187;
}
i3 = Math.max(i3, i7);
}
for (;;)
{
LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams)localView1.getLayoutParams();
i2 += MarginLayoutParamsCompat.getMarginStart(localLayoutParams) + localView1.getMeasuredWidth() + MarginLayoutParamsCompat.getMarginEnd(localLayoutParams);
i4++;
break;
label187:
i1 = Math.max(i1, i7 - localView1.getBaseline());
}
}
int i5 = Math.max(m + i1, i3) + (getPaddingTop() + getPaddingBottom());
if ((i2 > j) && (this.mFlexibleChild != null) && (this.mFlexibleChild.getVisibility() != 8))
{
int i6 = this.mFlexibleChild.getMeasuredWidth() - (i2 - j);
this.mFlexibleChild.measure(View.MeasureSpec.makeMeasureSpec(i6, 1073741824), View.MeasureSpec.makeMeasureSpec(this.mFlexibleChild.getMeasuredHeight(), 1073741824));
}
setMeasuredDimension(i, i5);
}