本文整理汇总了Java中android.support.v4.view.MarginLayoutParamsCompat.getMarginStart方法的典型用法代码示例。如果您正苦于以下问题:Java MarginLayoutParamsCompat.getMarginStart方法的具体用法?Java MarginLayoutParamsCompat.getMarginStart怎么用?Java MarginLayoutParamsCompat.getMarginStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.MarginLayoutParamsCompat
的用法示例。
在下文中一共展示了MarginLayoutParamsCompat.getMarginStart方法的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: onLayout
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
protected 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 = ViewCompat.getPaddingStart(this);
int k = MarginLayoutParamsCompat.getMarginStart((ViewGroup.MarginLayoutParams)this.mPromoContentView.getLayoutParams()) + getPaddingLeft();
int m = this.mPromoContentView.getMeasuredWidth();
int n = PlayUtils.getViewLeftFromParentStart(i, m, bool, k);
int i1 = getPaddingTop();
int i2 = i1 + this.mPromoContentView.getMeasuredHeight();
int i3 = i2 - this.mDefaultCardInset;
int i4 = this.mCardView.getMeasuredWidth();
int i5 = PlayUtils.getViewLeftFromParentStart(i, i4, bool, j);
this.mPromoContentView.layout(n, i1, n + m, i2);
if (this.mSeparator.getVisibility() == 0)
{
this.mSeparator.layout(0, i2, getMeasuredWidth(), i2 + this.mSeparator.getMeasuredHeight());
i3 += this.mSeparator.getMeasuredHeight();
}
this.mCardView.layout(i5, i3, i5 + i4, i3 + this.mCardView.getMeasuredHeight());
return;
}
}
示例3: getMarginStart
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginStart(View v) {
if (v == null) {
return 0;
}
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(lp);
}
示例4: 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);
}
示例5: 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);
}
示例6: getMarginStart
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginStart(View v)
{
if (v == null)
{
return 0;
}
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(lp);
}
示例7: 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);
}
示例8: onLayout
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
protected 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 = ViewCompat.getPaddingStart(this);
int j = ViewCompat.getPaddingEnd(this);
int k = getPaddingTop();
int m = getPaddingBottom();
int n = getWidth();
int i1 = getHeight();
ViewGroup.MarginLayoutParams localMarginLayoutParams1 = (ViewGroup.MarginLayoutParams)this.mThumbnail.getLayoutParams();
int i2 = this.mThumbnail.getMeasuredWidth();
int i3 = this.mThumbnail.getMeasuredHeight();
int i4 = PlayUtils.getViewLeftFromParentStart(n, i2, bool, i + MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams1));
this.mThumbnail.layout(i4, k + localMarginLayoutParams1.topMargin, i4 + i2, i3 + (k + localMarginLayoutParams1.topMargin));
ViewGroup.MarginLayoutParams localMarginLayoutParams2 = (ViewGroup.MarginLayoutParams)this.mTitle.getLayoutParams();
int i5 = k + i3 + localMarginLayoutParams2.topMargin;
int i6 = i + MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams2);
int i7 = this.mTitle.getMeasuredWidth();
int i8 = this.mTitle.getMeasuredHeight();
int i9 = PlayUtils.getViewLeftFromParentStart(n, i7, bool, i6);
this.mTitle.layout(i9, i5, i9 + i7, i5 + i8);
int i10 = this.mLoadingIndicator.getMeasuredWidth();
int i11 = this.mLoadingIndicator.getMeasuredHeight();
int i12 = i + (n - i - j - i10) / 2;
int i13 = k + (i1 - k - m - i11) / 2;
int i14 = PlayUtils.getViewLeftFromParentStart(n, i10, bool, i12);
this.mLoadingIndicator.layout(i14, i13, i14 + i10, i13 + this.mLoadingIndicator.getMeasuredHeight());
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: getMarginStart
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
static int getMarginStart(View v) {
if (v == null) {
return 0;
}
return MarginLayoutParamsCompat.getMarginStart((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: 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;
}
}
}
示例14: 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);
}
示例15: getSideMargins
import android.support.v4.view.MarginLayoutParamsCompat; //导入方法依赖的package包/类
public static int getSideMargins(View paramView)
{
ViewGroup.MarginLayoutParams localMarginLayoutParams = (ViewGroup.MarginLayoutParams)paramView.getLayoutParams();
return MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams) + MarginLayoutParamsCompat.getMarginEnd(localMarginLayoutParams);
}