当前位置: 首页>>代码示例>>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;未经允许,请勿转载。