本文整理汇总了Java中android.support.v4.view.GravityCompat.END属性的典型用法代码示例。如果您正苦于以下问题:Java GravityCompat.END属性的具体用法?Java GravityCompat.END怎么用?Java GravityCompat.END使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.view.GravityCompat
的用法示例。
在下文中一共展示了GravityCompat.END属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDrawerShadow
public void setDrawerShadow(Drawable shadowDrawable, int gravity) {
if (!SET_DRAWER_SHADOW_FROM_ELEVATION) {
if ((gravity & GravityCompat.START) == GravityCompat.START) {
this.mShadowStart = shadowDrawable;
} else if ((gravity & GravityCompat.END) == GravityCompat.END) {
this.mShadowEnd = shadowDrawable;
} else if ((gravity & 3) == 3) {
this.mShadowLeft = shadowDrawable;
} else if ((gravity & 5) == 5) {
this.mShadowRight = shadowDrawable;
} else {
return;
}
resolveShadowDrawables();
invalidate();
}
}
示例2: RecyclerViewScrollbar
public RecyclerViewScrollbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RecyclerViewScrollbar, defStyleAttr, 0);
mRecyclerViewId = ta.getResourceId(R.styleable.RecyclerViewScrollbar_recyclerView, 0);
mScrollbarDrawable = ta.getDrawable(R.styleable.RecyclerViewScrollbar_scrollbarDrawable);
mLetterDrawable = ta.getDrawable(R.styleable.RecyclerViewScrollbar_letterDrawable);
int letterTextResId = ta.getResourceId(R.styleable.RecyclerViewScrollbar_letterTextAppearance, 0);
mMinScrollbarHeight = ta.getDimensionPixelOffset(R.styleable.RecyclerViewScrollbar_minScrollbarHeight, 0);
ta.recycle();
mLetterView = new TextView(getContext());
mLetterView.setBackgroundDrawable(mLetterDrawable);
TextViewCompat.setTextAppearance(mLetterView, letterTextResId);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = GravityCompat.END;
mLetterView.setLayoutParams(params);
mLetterView.setGravity(Gravity.CENTER);
}
示例3: initActionbar
private void initActionbar() {
View view_tab = LayoutInflater.from(this).inflate(R.layout.h1, null);
this.mSlidingTab = (PagerSlidingTabStrip) view_tab.findViewById(R.id.sliding_tabs);
LayoutParams layoutParams = new LayoutParams(-2, -1);
layoutParams.gravity = GravityCompat.END;
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setCustomView(view_tab, layoutParams);
this.mSlidingTab.setViewPager(this.viewpager);
this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
super.onPageSelected(position);
if (position == 1 && !GoodsDetailActivity.this.isSecondLoad) {
GoodsDetailActivity.this.goodsPostsFragment.loadFirst();
GoodsDetailActivity.this.isSecondLoad = true;
}
}
});
}
示例4: setDrawerLockMode
public void setDrawerLockMode(int lockMode, int edgeGravity) {
int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this));
switch (edgeGravity) {
case 3:
this.mLockModeLeft = lockMode;
break;
case 5:
this.mLockModeRight = lockMode;
break;
case GravityCompat.START /*8388611*/:
this.mLockModeStart = lockMode;
break;
case GravityCompat.END /*8388613*/:
this.mLockModeEnd = lockMode;
break;
}
if (lockMode != 0) {
(absGravity == 3 ? this.mLeftDragger : this.mRightDragger).cancel();
}
switch (lockMode) {
case 1:
View toClose = findDrawerWithGravity(absGravity);
if (toClose != null) {
closeDrawer(toClose);
return;
}
return;
case 2:
View toOpen = findDrawerWithGravity(absGravity);
if (toOpen != null) {
openDrawer(toOpen);
return;
}
return;
default:
return;
}
}
示例5: updateLeftPositionByGravity
private void updateLeftPositionByGravity(ViewPosition pos, int size, int gravity) {
switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case GravityCompat.END:
pos.left += (size > 0) ? size : 0;
break;
case Gravity.CENTER_HORIZONTAL:
pos.left += ((size > 0) ? size : 0) / 2;
break;
}
}
示例6: initView
private void initView() {
this.mViewPager = (ViewPager) findViewById(R.id.viewpager);
this.mViewPager.setAdapter(new MainPagerAdapter(getSupportFragmentManager(), this
.mContentFragments));
this.mCustomView = LayoutInflater.from(this).inflate(R.layout.lz, null);
this.mSlidingTab = (PagerSlidingTabStrip) this.mCustomView.findViewById(R.id.sliding_tabs);
this.mSlidingTab.setViewPager(this.mViewPager);
this.mViewPager.setCurrentItem(this.position);
getSupportActionBar().setDisplayShowCustomEnabled(true);
LayoutParams layoutParams = new LayoutParams(-2, -1);
layoutParams.gravity = GravityCompat.END;
getSupportActionBar().setCustomView(this.mCustomView, layoutParams);
}
示例7: initActionbar
private void initActionbar() {
View actionBar = LayoutInflater.from(this).inflate(R.layout.f1, null);
LayoutParams layoutParams = new LayoutParams(-2, -1);
layoutParams.gravity = GravityCompat.END;
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setCustomView(actionBar, layoutParams);
}
示例8: ensureMenuView
private void ensureMenuView() {
if (this.mMenuView == null) {
this.mMenuView = new ActionMenuView(getContext());
this.mMenuView.setPopupTheme(this.mPopupTheme);
this.mMenuView.setOnMenuItemClickListener(this.mMenuViewItemClickListener);
this.mMenuView.setMenuCallbacks(this.mActionMenuPresenterCallback, this.mMenuBuilderCallback);
LayoutParams lp = generateDefaultLayoutParams();
lp.gravity = GravityCompat.END | (this.mButtonGravity & 112);
this.mMenuView.setLayoutParams(lp);
addSystemView(this.mMenuView, false);
}
}
示例9: onDrawState
@Override
public void onDrawState(EmptyStateRecyclerView rv, Canvas canvas) {
final int width = rv.getMeasuredWidth();
final int height = rv.getMeasuredHeight();
configureImage(width, height);
final int horizontalGravity = Gravity.getAbsoluteGravity(imageGravity,
ViewCompat.getLayoutDirection(rv))&Gravity.HORIZONTAL_GRAVITY_MASK;
final int verticalGravity = imageGravity&Gravity.VERTICAL_GRAVITY_MASK;
// Account for horizontal gravity
float dx;
switch (horizontalGravity) {
case Gravity.CENTER_HORIZONTAL:
dx = (width >> 1) - (image.getWidth() >> 1);
break;
case GravityCompat.END:
dx = width - image.getWidth();
break;
default:
case GravityCompat.START:
dx = 0;
break;
}
// Account for vertical gravity
float dy;
switch (verticalGravity) {
case Gravity.CENTER_VERTICAL:
dy = (height >> 1) - (image.getHeight() >> 1);
break;
case Gravity.BOTTOM:
dy = height - image.getHeight();
break;
default:
case Gravity.TOP:
dy = 0;
break;
}
// Account for the set margins
dx -= getPaddingLeft(); // Left margin
dx += getPaddingRight(); // Right margin
dy += getPaddingTop(); // Top margin
dy -= getPaddingBottom(); // Bottom margin
// Draw bitmap using locations based on gravity
canvas.drawBitmap(image, dx, dy, null);
}
示例10: getDrawerLockMode
public int getDrawerLockMode(int edgeGravity) {
int layoutDirection = ViewCompat.getLayoutDirection(this);
switch (edgeGravity) {
case 3:
if (this.mLockModeLeft != 3) {
return this.mLockModeLeft;
}
int leftLockMode = layoutDirection == 0 ? this.mLockModeStart : this.mLockModeEnd;
if (leftLockMode != 3) {
return leftLockMode;
}
break;
case 5:
if (this.mLockModeRight != 3) {
return this.mLockModeRight;
}
int rightLockMode = layoutDirection == 0 ? this.mLockModeEnd : this.mLockModeStart;
if (rightLockMode != 3) {
return rightLockMode;
}
break;
case GravityCompat.START /*8388611*/:
if (this.mLockModeStart != 3) {
return this.mLockModeStart;
}
int startLockMode = layoutDirection == 0 ? this.mLockModeLeft : this.mLockModeRight;
if (startLockMode != 3) {
return startLockMode;
}
break;
case GravityCompat.END /*8388613*/:
if (this.mLockModeEnd != 3) {
return this.mLockModeEnd;
}
int endLockMode = layoutDirection == 0 ? this.mLockModeRight : this.mLockModeLeft;
if (endLockMode != 3) {
return endLockMode;
}
break;
}
return 0;
}
示例11: resolveKeylineGravity
/**
* Return the given gravity value or the default if the passed value is NO_GRAVITY.
* This should be used for children that are positioned relative to a keyline.
*/
private static int resolveKeylineGravity(int gravity) {
return gravity == Gravity.NO_GRAVITY ? GravityCompat.END | Gravity.TOP : gravity;
}