當前位置: 首頁>>代碼示例>>Java>>正文


Java Gravity.isVertical方法代碼示例

本文整理匯總了Java中android.view.Gravity.isVertical方法的典型用法代碼示例。如果您正苦於以下問題:Java Gravity.isVertical方法的具體用法?Java Gravity.isVertical怎麽用?Java Gravity.isVertical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.Gravity的用法示例。


在下文中一共展示了Gravity.isVertical方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addArrowView

import android.view.Gravity; //導入方法依賴的package包/類
/**
 * Adds an arrow view pointing at the original icon.
 * @param horizontalOffset the horizontal offset of the arrow, so that it
 *                              points at the center of the original icon
 */
private View addArrowView(int horizontalOffset, int verticalOffset, int width, int height) {
    LayoutParams layoutParams = new LayoutParams(width, height);
    if (mIsLeftAligned) {
        layoutParams.gravity = Gravity.START;
        layoutParams.leftMargin = horizontalOffset;
    } else {
        layoutParams.gravity = Gravity.END;
        layoutParams.rightMargin = horizontalOffset;
    }
    if (mIsAboveIcon) {
        layoutParams.topMargin = verticalOffset;
    } else {
        layoutParams.bottomMargin = verticalOffset;
    }

    View arrowView = new View(getContext());
    if (Gravity.isVertical(((FrameLayout.LayoutParams) getLayoutParams()).gravity)) {
        // This is only true if there wasn't room for the container next to the icon,
        // so we centered it instead. In that case we don't want to show the arrow.
        arrowView.setVisibility(INVISIBLE);
    } else {
        ShapeDrawable arrowDrawable = new ShapeDrawable(TriangleShape.create(
                width, height, !mIsAboveIcon));
        Paint arrowPaint = arrowDrawable.getPaint();
        // Note that we have to use getChildAt() instead of getItemViewAt(),
        // since the latter expects the arrow which hasn't been added yet.
        PopupItemView itemAttachedToArrow = (PopupItemView)
                (getChildAt(mIsAboveIcon ? getChildCount() - 1 : 0));
        arrowPaint.setColor(itemAttachedToArrow.getArrowColor(mIsAboveIcon));
        // The corner path effect won't be reflected in the shadow, but shouldn't be noticeable.
        int radius = getResources().getDimensionPixelSize(R.dimen.popup_arrow_corner_radius);
        arrowPaint.setPathEffect(new CornerPathEffect(radius));
        arrowView.setBackground(arrowDrawable);
        arrowView.setElevation(getElevation());
    }
    addView(arrowView, mIsAboveIcon ? getChildCount() : 0, layoutParams);
    return arrowView;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:44,代碼來源:PopupContainerWithArrow.java

示例2: VerticalTextView

import android.view.Gravity; //導入方法依賴的package包/類
public VerticalTextView(Context context, AttributeSet attrs){
    super(context, attrs);
    final int gravity = getGravity();
    if (Gravity.isVertical(gravity) && (gravity&Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
        setGravity((gravity&Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
        topDown = false;
    } else {
        topDown = true;
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:11,代碼來源:VerticalTextView.java

示例3: VerticalTextView

import android.view.Gravity; //導入方法依賴的package包/類
public VerticalTextView(Context context, AttributeSet attrs){
    super(context, attrs);
    final int gravity = getGravity();
    if(Gravity.isVertical(gravity) && (gravity&Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
        setGravity((gravity&Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
        topDown = false;
    }else
        topDown = true;
}
 
開發者ID:andresth,項目名稱:Kandroid,代碼行數:10,代碼來源:VerticalTextView.java

示例4: VerticalTextView

import android.view.Gravity; //導入方法依賴的package包/類
public VerticalTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    final int gravity = getGravity();
    if (Gravity.isVertical(gravity)
            && (gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
        setGravity((gravity & Gravity.HORIZONTAL_GRAVITY_MASK)
                | Gravity.TOP);
        topDown = false;
    } else
        topDown = true;
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:12,代碼來源:VerticalTextView.java

示例5: VerticalTextView

import android.view.Gravity; //導入方法依賴的package包/類
public VerticalTextView(Context context, AttributeSet attrs){
   super(context, attrs);
   final int gravity = getGravity();
   if(Gravity.isVertical(gravity) && (gravity&Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      setGravity((gravity&Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
      topDown = false;
   }else
      topDown = true;
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:10,代碼來源:VerticalTextView.java


注:本文中的android.view.Gravity.isVertical方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。