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


Java Gravity.END屬性代碼示例

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


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

示例1: findSnapView

public View findSnapView(RecyclerView.LayoutManager layoutManager) {
    View snapView = null;
    if (layoutManager instanceof LinearLayoutManager) {
        switch (gravity) {
            case Gravity.START:
                snapView = findStartView(layoutManager, getHorizontalHelper(layoutManager));
                break;
            case Gravity.END:
                snapView = findEndView(layoutManager, getHorizontalHelper(layoutManager));
                break;
            case Gravity.TOP:
                snapView = findStartView(layoutManager, getVerticalHelper(layoutManager));
                break;
            case Gravity.BOTTOM:
                snapView = findEndView(layoutManager, getVerticalHelper(layoutManager));
                break;
        }
    }
    snapping = snapView != null;
    return snapView;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:GravityDelegate.java

示例2: onTargetAlignmentChanged

@OnCheckedChanged({ R.id.target_align_start, R.id.target_align_center, R.id.target_align_end })
void onTargetAlignmentChanged(RadioButton button, boolean isChecked) {
    if (isChecked) {
        int alignment = Gravity.NO_GRAVITY;
        switch (button.getId()) {
            case R.id.target_align_start:
                alignment = Gravity.START;
                break;
            case R.id.target_align_center:
                alignment = Gravity.CENTER_HORIZONTAL;
                break;
            case R.id.target_align_end:
                alignment = Gravity.END;
                break;
        }
        onUpdateListener.updateTargetTextAlignment(alignment);
    }
}
 
開發者ID:shazam,項目名稱:reflow-animator,代碼行數:18,代碼來源:AdvancedOptionsDialogFragment.java

示例3: findSnapView

@Override
public View findSnapView(RecyclerView.LayoutManager layoutManager) {
    View snapView = null;
    if (layoutManager instanceof LinearLayoutManager) {
        switch (mGravity) {
            case Gravity.START:
                snapView = findStartView(layoutManager, getHorizontalHelper(layoutManager));
                break;
            case Gravity.END:
                snapView = findEndView(layoutManager, getHorizontalHelper(layoutManager));
                break;
            case Gravity.TOP:
                snapView = findStartView(layoutManager, getVerticalHelper(layoutManager));
                break;
            case Gravity.BOTTOM:
                snapView = findEndView(layoutManager, getVerticalHelper(layoutManager));
                break;
        }
    }

    mSnapping = snapView != null;

    return snapView;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:24,代碼來源:GravitySnapHelper.java

示例4: getGravity

private int getGravity(String gravity) {
    switch (gravity) {
        case "CENTER":
            return Gravity.CENTER;
        case "CENTER_VERTICAL":
            return Gravity.CENTER_VERTICAL;
        case "TOP":
            return Gravity.TOP;
        case "LEFT":
            return Gravity.LEFT;
        case "RIGHT":
            return Gravity.RIGHT;
        case "BOTTOM":
            return Gravity.BOTTOM;
        case "START":
            return Gravity.START;
        case "END":
            return Gravity.END;
        default:
            return Gravity.CENTER_VERTICAL;
    }
}
 
開發者ID:cesardeazevedo,項目名稱:react-native-collapsing-toolbar,代碼行數:22,代碼來源:CollapsingToolbarLayoutManager.java

示例5: positionItems

/**
 * Positions the children at the "correct" positions
 */
private void positionItems() {
    final int childCount = getChildCount();
    int left = getPaddingStart();
    if (getFixedGravity() == Gravity.CENTER) {
        left += (getContentWidth() - childCount * (itemSize + minItemSpacing) + minItemSpacing) / 2;
    } else if (getFixedGravity() == Gravity.END) {
        left += (getContentWidth() - childCount * (itemSize + minItemSpacing) + minItemSpacing);
    }
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

        final int childWidth = child.getMeasuredWidth();
        final int childHeight = child.getMeasuredHeight();
        final int top = (getHeight() - childHeight) / 2;
        final int contentWidth = getContentWidth();
        final int itemSpacing = getItemSpacing(childCount, contentWidth, childWidth);

        child.layout(left, top, left + childWidth, top + childHeight);

        if (!isLastChild(i)) {
            left += childWidth + itemSpacing;
        }
    }
}
 
開發者ID:AppliKey,項目名稱:ImageMore,代碼行數:27,代碼來源:ImageMoreView.java

示例6: getSnappedPosition

int getSnappedPosition(RecyclerView recyclerView) {
    RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();

    if (layoutManager instanceof LinearLayoutManager) {
        if (gravity == Gravity.START || gravity == Gravity.TOP) {
            return ((LinearLayoutManager) layoutManager).findFirstCompletelyVisibleItemPosition();
        } else if (gravity == Gravity.END || gravity == Gravity.BOTTOM) {
            return ((LinearLayoutManager) layoutManager).findLastCompletelyVisibleItemPosition();
        }
    }

    return RecyclerView.NO_POSITION;
}
 
開發者ID:ApplikeySolutions,項目名稱:CosmoCalendar,代碼行數:13,代碼來源:GravityDelegate.java

示例7: getTextAlign

private int getTextAlign(String textAlign) {
  int align = Gravity.START;
  if (TextUtils.isEmpty(textAlign)) {
    return align;
  }
  if (textAlign.equals(Constants.Value.LEFT)) {
    align = Gravity.START;
  } else if (textAlign.equals(Constants.Value.CENTER)) {
    align = Gravity.CENTER;
  } else if (textAlign.equals(Constants.Value.RIGHT)) {
    align = Gravity.END;
  }
  return align;
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:14,代碼來源:AbstractEditComponent.java

示例8: onAction

@Override
public void onAction(View actionView, final int position) {
    final Song song = mAdapter.getItem(position);
    PopupMenu actionMenu = new PopupMenu(this, actionView, Gravity.END | Gravity.BOTTOM);
    actionMenu.inflate(R.menu.music_action);
    actionMenu.getMenu().findItem(R.id.menu_item_delete).setVisible(!isFolder);
    actionMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.menu_item_add_to_play_list:
                    new AddToPlayListDialogFragment()
                            .setCallback(new AddToPlayListDialogFragment.Callback() {
                                @Override
                                public void onPlayListSelected(PlayList playList) {
                                    if (playList.getId() == mPlayList.getId()) return;
                                    mPresenter.addSongToPlayList(song, playList);
                                }
                            })
                            .show(getSupportFragmentManager().beginTransaction(), "AddToPlayList");
                    break;
                case R.id.menu_item_delete:
                    mDeleteIndex = position;
                    mPresenter.delete(song, mPlayList);
                    break;
            }
            return true;
        }
    });
    actionMenu.show();
}
 
開發者ID:xxczaki,項目名稱:music-player,代碼行數:31,代碼來源:PlayListDetailsActivity.java

示例9: getGravity

private ViewGroup.LayoutParams getGravity(View childView) {
    FrameLayout.LayoutParams lp = (LayoutParams) childView.getLayoutParams();
    if (isGravityCenter) {
        lp.gravity = Gravity.CENTER;
    } else if (isGravityBottom) {
        if (isGravityEnd) {
            lp.gravity = Gravity.BOTTOM | Gravity.END;
        } else if (isGravityCenterHorizontal) {
            lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
        } else {
            lp.gravity = Gravity.BOTTOM;
        }
    } else if (isGravityEnd) {
        if (isGravityCenterVertical) {
            lp.gravity = Gravity.CENTER_VERTICAL | Gravity.END;
        } else {
            lp.gravity = Gravity.TOP | Gravity.END;
        }
    } else if (isGravityTop) {
        lp.gravity = Gravity.TOP;
    } else if (isGravityCenterHorizontal) {
        lp.gravity = Gravity.CENTER_HORIZONTAL;
    } else if (isGravityCenterVertical) {
        lp.gravity = Gravity.CENTER_VERTICAL;
    }
    return lp;
}
 
開發者ID:robertlevonyan,項目名稱:customFloatingActionButton,代碼行數:27,代碼來源:FloatingLayout.java

示例10: convertGravity

private static int convertGravity(View view, int gravity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        boolean isRtl = view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
        if (gravity == Gravity.START) {
            gravity = isRtl ? Gravity.RIGHT : Gravity.LEFT;
        } else if (gravity == Gravity.END) {
            gravity = isRtl ? Gravity.LEFT : Gravity.RIGHT;
        }
    }
    return gravity;
}
 
開發者ID:rumaan,項目名稱:AcademApp,代碼行數:11,代碼來源:MaterialIn.java

示例11: attachToRecyclerView

@Override
public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
        throws IllegalStateException {
    if (recyclerView != null) {
        if (mGravity == Gravity.START || mGravity == Gravity.END) {
            mIsRtlHorizontal
                    = recyclerView.getContext().getResources().getBoolean(R.bool.is_rtl);
        }
        if (mSnapListener != null) {
            recyclerView.addOnScrollListener(mScrollListener);
        }
    }
    super.attachToRecyclerView(recyclerView);
}
 
開發者ID:mangoblogger,項目名稱:MangoBloggerAndroidApp,代碼行數:14,代碼來源:GravitySnapHelper.java

示例12: init

private void init(Context context) {
    inflate(context, R.layout.detail_images_wrapper,  this);
    ButterKnife.bind(this);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    SnapHelper snapHelper = new GravitySnapHelper(Gravity.END);
    snapHelper.attachToRecyclerView(recyclerView);
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
}
 
開發者ID:prakh25,項目名稱:MovieApp,代碼行數:14,代碼來源:MovieImagesWrapper.java

示例13: getTextView

/**
 * 根據位置獲取TextView
 *
 * @param gravity 參考{@link Gravity}
 * @return
 */
public TextView getTextView(int gravity) {
    if (gravity == Gravity.LEFT || gravity == Gravity.START) {
        return mLeftTv;
    } else if (gravity == (Gravity.CENTER | Gravity.TOP)) {
        return mTitleMain;
    } else if (gravity == (Gravity.CENTER | Gravity.BOTTOM)) {
        return mTitleSub;
    } else if (gravity == Gravity.END || gravity == Gravity.RIGHT) {
        return mRightTv;
    }
    return mTitleMain;
}
 
開發者ID:AriesHoo,項目名稱:UIWidget,代碼行數:18,代碼來源:TitleBarView.java

示例14: GravitySnapHelper

public GravitySnapHelper(int gravity, boolean enableSnapLastItem, SnapListener snapListener) {
    if (gravity != Gravity.START && gravity != Gravity.END
            && gravity != Gravity.BOTTOM && gravity != Gravity.TOP) {
        throw new IllegalArgumentException("Invalid gravity value. Use START " +
                "| END | BOTTOM | TOP constants");
    }
    mSnapListener = snapListener;
    mGravity = gravity;
    mSnapLastItemEnabled = enableSnapLastItem;
}
 
開發者ID:mangoblogger,項目名稱:MangoBloggerAndroidApp,代碼行數:10,代碼來源:GravitySnapHelper.java

示例15: calculate

public void calculate() {

        for (AnimExpectation animExpectation : animExpectations) {
            if (animExpectation instanceof ScaleAnimExpectation) {
                final ScaleAnimExpectation expectation = (ScaleAnimExpectation) animExpectation;

                expectation.setViewCalculator(viewCalculator);

                final Float scaleX = expectation.getCalculatedValueScaleX(viewToMove);
                if (scaleX != null) {
                    this.scaleX = scaleX;
                }

                final Float scaleY = expectation.getCalculatedValueScaleY(viewToMove);
                if (scaleY != null) {
                    this.scaleY = scaleY;
                }

                final Integer gravityHorizontal = expectation.getGravityHorizontal();
                if (gravityHorizontal != null) {
                    switch (gravityHorizontal){
                        case Gravity.LEFT:
                        case Gravity.START:
                            pivotX = (float)viewToMove.getLeft();
                            break;
                        case Gravity.RIGHT:
                        case Gravity.END:
                            pivotX = (float)viewToMove.getRight();
                            break;
                        case Gravity.CENTER_HORIZONTAL:
                        case Gravity.CENTER : pivotX = viewToMove.getLeft() + viewToMove.getWidth()/2f; break;
                    }
                }

                final Integer gravityVertical = expectation.getGravityVertical();
                if (gravityVertical != null) {
                    switch (gravityVertical){
                        case Gravity.TOP : pivotY = (float)viewToMove.getTop(); break;
                        case Gravity.BOTTOM : pivotY = (float)viewToMove.getBottom(); break;
                        case Gravity.CENTER_VERTICAL:
                        case Gravity.CENTER : pivotY = viewToMove.getTop() + viewToMove.getHeight()/2f; break;
                    }
                }

            }
        }
    }
 
開發者ID:GcsSloop,項目名稱:diycode,代碼行數:47,代碼來源:ExpectAnimScaleManager.java


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