当前位置: 首页>>代码示例>>Java>>正文


Java ViewCompat.LAYOUT_DIRECTION_RTL属性代码示例

本文整理汇总了Java中android.support.v4.view.ViewCompat.LAYOUT_DIRECTION_RTL属性的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.LAYOUT_DIRECTION_RTL属性的具体用法?Java ViewCompat.LAYOUT_DIRECTION_RTL怎么用?Java ViewCompat.LAYOUT_DIRECTION_RTL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.LAYOUT_DIRECTION_RTL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLayoutDirection

/**
 * Force set layout direction to RTL or LTR by Locale.
 *
 * @param view
 * @param locale
 */
public static void setLayoutDirection(View view, Locale locale) {
    switch (TextUtilsCompat.getLayoutDirectionFromLocale(locale)) {
        case ViewCompat.LAYOUT_DIRECTION_RTL:
            ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_RTL);
            break;
        case ViewCompat.LAYOUT_DIRECTION_LTR:
        default:
            ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LTR);
            break;
    }
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:17,代码来源:LocaleAwareAppCompatActivity.java

示例2: clampViewPositionHorizontal

@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
    final boolean isRtl = ViewCompat.getLayoutDirection(child)
            == ViewCompat.LAYOUT_DIRECTION_RTL;
  int min, max;

  if (mSwipeDirection == SWIPE_DIRECTION_START_TO_END) {
    if (isRtl) {
      min = mOriginalCapturedViewLeft - child.getWidth();
      max = mOriginalCapturedViewLeft;
    } else {
      min = mOriginalCapturedViewLeft;
      max = mOriginalCapturedViewLeft + child.getWidth();
    }
  } else if (mSwipeDirection == SWIPE_DIRECTION_END_TO_START) {
    if (isRtl) {
      min = mOriginalCapturedViewLeft;
      max = mOriginalCapturedViewLeft + child.getWidth();
    } else {
      min = mOriginalCapturedViewLeft - child.getWidth();
      max = mOriginalCapturedViewLeft;
    }
  } else {
    min = mOriginalCapturedViewLeft - child.getWidth();
    max = mOriginalCapturedViewLeft + child.getWidth();
  }

  return clamp(min, left, max);
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:29,代码来源:SwipeDismissBehavior.java

示例3: LabelSpan

public LabelSpan(int color) {
    this(color, new SpanDimensions() {
        @Override public int getPadding() {
            return 6;
        }

        @Override public int getPaddingExtraWidth() {
            return 0;
        }

        @Override public int getPaddingAfter() {
            return 0;
        }

        @Override public int getMaxWidth() {
            return 1000;//random number
        }

        @Override public float getRoundedCornerRadius() {
            return 5;
        }

        @Override public int getMarginTop() {
            return 8;
        }

        @Override public boolean isRtl() {
            return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL;
        }
    });
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:31,代码来源:LabelSpan.java

示例4: setIndicatorPosition

public void setIndicatorPosition(final int stepPos, final int totalStepNum) {
    final int layoutDirection = ViewCompat.getLayoutDirection(this);
    // The indicator position is the center of the partition that is equally divided into
    // the total step number.
    final float partionWidth = 1.0f / totalStepNum;
    final float pos = stepPos * partionWidth + partionWidth / 2.0f;
    mXRatio = (layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL) ? 1.0f - pos : pos;
    invalidate();
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:9,代码来源:SetupStepIndicatorView.java

示例5: onRecordMoved

@Override
public void onRecordMoved(float x, float absoluteX) {
  slideToCancel.moveTo(x);

  int   direction = ViewCompat.getLayoutDirection(this);
  float position  = absoluteX / recordingContainer.getWidth();

  if (direction == ViewCompat.LAYOUT_DIRECTION_LTR && position <= 0.5 ||
      direction == ViewCompat.LAYOUT_DIRECTION_RTL && position >= 0.6)
  {
    this.microphoneRecorderView.cancelAction();
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:13,代码来源:InputPanel.java

示例6: calculateIsRtl

private boolean calculateIsRtl(CharSequence text) {
      final boolean defaultIsRtl = ViewCompat.getLayoutDirection(mView)
              == ViewCompat.LAYOUT_DIRECTION_RTL;
  return (defaultIsRtl
          ? TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL
              : TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR).isRtl(text, 0, text.length());
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:7,代码来源:CollapsingTextHelper.java

示例7: layoutChildWithKeyline

/**
 * Lay out a child view with respect to a keyline.
 *
   * <p>The keyline represents a horizontal offset from the unpadded starting edge of
   * the CoordinatorLayout. The child's gravity will affect how it is positioned with
   * respect to the keyline.</p>
 *
 * @param child child to lay out
 * @param keyline offset from the starting edge in pixels of the keyline to align with
 * @param layoutDirection ViewCompat constant for layout direction
 */
private void layoutChildWithKeyline(View child, int keyline, int layoutDirection) {
  final LayoutParams lp = (LayoutParams) child.getLayoutParams();
      final int absGravity = GravityCompat.getAbsoluteGravity(
              resolveKeylineGravity(lp.gravity), layoutDirection);

  final int hgrav = absGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
  final int vgrav = absGravity & Gravity.VERTICAL_GRAVITY_MASK;
  final int width = getWidth();
  final int height = getHeight();
  final int childWidth = child.getMeasuredWidth();
  final int childHeight = child.getMeasuredHeight();

  if (layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL) {
    keyline = width - keyline;
  }

  int left = getKeyline(keyline) - childWidth;
  int top = 0;

  switch (hgrav) {
    default:
    case Gravity.LEFT:
      // Nothing to do.
      break;
    case Gravity.RIGHT:
      left += childWidth;
      break;
    case Gravity.CENTER_HORIZONTAL:
      left += childWidth / 2;
      break;
  }

  switch (vgrav) {
    default:
    case Gravity.TOP:
      // Do nothing, we're already in position.
      break;
    case Gravity.BOTTOM:
      top += childHeight;
      break;
    case Gravity.CENTER_VERTICAL:
      top += childHeight / 2;
      break;
  }

  // Obey margins and padding
      left = Math.max(getPaddingLeft() + lp.leftMargin,
              Math.min(left,
                      width - getPaddingRight() - childWidth - lp.rightMargin));
      top = Math.max(getPaddingTop() + lp.topMargin,
              Math.min(top,
                      height - getPaddingBottom() - childHeight - lp.bottomMargin));

  child.layout(left, top, left + childWidth, top + childHeight);
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:66,代码来源:CoordinatorLayout.java

示例8: isLayoutRtl

static boolean isLayoutRtl(View v) {
  return ViewCompat.getLayoutDirection(v) == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:weileng11,项目名称:KUtils-master,代码行数:3,代码来源:Utils.java

示例9: isLayoutRTL

boolean isLayoutRTL() {
    return getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:3,代码来源:StaggeredGridLayoutManager.java

示例10: isLayoutRTL

protected boolean isLayoutRTL() {
    return getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:3,代码来源:LinearLayoutManager.java

示例11: isRtl

public static boolean isRtl() {
  return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
      == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:4,代码来源:QuranUtils.java

示例12: isDevicePreferredLanguageRTL

private boolean isDevicePreferredLanguageRTL() {
 final int directionality =
   TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault());
 return directionality == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:5,代码来源:I18nUtil.java

示例13: isLayoutRtl

protected boolean isLayoutRtl() {
    return ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:3,代码来源:RecyclerTabLayout.java

示例14: isLayoutRtl

public static boolean isLayoutRtl(View view) {
    return ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:3,代码来源:ViewUtils.java

示例15: isLayoutRTL

/**
 * @return true if RTL mode enabled in RecyclerView
 */
public boolean isLayoutRTL() {
    return getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:sathishmscict,项目名称:ChipsLayoutManager,代码行数:6,代码来源:ChipsLayoutManager.java


注:本文中的android.support.v4.view.ViewCompat.LAYOUT_DIRECTION_RTL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。