本文整理汇总了Java中android.view.Gravity.BOTTOM属性的典型用法代码示例。如果您正苦于以下问题:Java Gravity.BOTTOM属性的具体用法?Java Gravity.BOTTOM怎么用?Java Gravity.BOTTOM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.Gravity
的用法示例。
在下文中一共展示了Gravity.BOTTOM属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findSnapView
@Override public View findSnapView(RecyclerView.LayoutManager layoutManager) {
if (layoutManager instanceof LinearLayoutManager) {
switch (mGravity) {
case Gravity.START:
return findStartView(layoutManager, getHorizontalHelper(layoutManager));
case Gravity.TOP:
return findStartView(layoutManager, getVerticalHelper(layoutManager));
case Gravity.END:
return findEndView(layoutManager, getHorizontalHelper(layoutManager));
case Gravity.BOTTOM:
return findEndView(layoutManager, getVerticalHelper(layoutManager));
}
}
return super.findSnapView(layoutManager);
}
示例2: initWindowParameter
private WindowManager.LayoutParams initWindowParameter() {
mWindowParam = new WindowManager.LayoutParams();
mWindowParam.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
mWindowParam.format = 1;
mWindowParam.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mWindowParam.flags = mWindowParam.flags | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
mWindowParam.flags = mWindowParam.flags | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
mWindowParam.alpha = 1.0f;
mWindowParam.gravity = Gravity.BOTTOM | Gravity.RIGHT;
mWindowParam.x = 0;
mWindowParam.y = 0;
mWindowParam.width = mWindowWidth;
mWindowParam.height = mWindowHeight;
return mWindowParam;
}
示例3: setWindowParams
private void setWindowParams(int x, int y) {
// 建立item的缩略图
windowParams = new WindowManager.LayoutParams();
windowParams.gravity = Gravity.BOTTOM | Gravity.RIGHT;// 这个必须加
// 得到preview左上角相对于屏幕的坐标
windowParams.x = x;
windowParams.y = y;
// 设置宽和高
windowParams.width = 80;
windowParams.height = 50;
windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
windowParams.format = PixelFormat.TRANSLUCENT;
windowParams.windowAnimations = 0;
}
示例4: HTViewPagerWithIndicator
public HTViewPagerWithIndicator(Context context, AttributeSet attrs) {
super(context, attrs);
// 添加SlidingTabLayout
readStyleParameters(attrs);
ViewPager.LayoutParams lp = new ViewPager.LayoutParams();
lp.height = ViewPager.LayoutParams.WRAP_CONTENT;
lp.width = ViewPager.LayoutParams.MATCH_PARENT;
lp.gravity = mSlidingTabLayoutGravity == 0 ? Gravity.TOP : Gravity.BOTTOM;
mSlidingTabLayout = new SlidingTabLayout(getContext(), attrs);
mDataSetObserver = new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
mSlidingTabLayout.notifyDataSetChanged();
}
@Override
public void onInvalidated() {
super.onInvalidated();
}
};
addView(mSlidingTabLayout, -1, lp);
}
示例5: 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;
}
示例6: onStart
@Override
public void onStart() {
super.onStart();
Window window = getDialog().getWindow();
if (window != null) {
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.BOTTOM;
params.width = WindowManager.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
}
示例7: showCart
private void showCart(View view) {
if(shopCart!=null && shopCart.getShoppingAccount()>0){
ShopCartDialog dialog = new ShopCartDialog(this,shopCart,R.style.cartdialog);
Window window = dialog.getWindow();
dialog.setShopCartDialogImp(this);
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(true);
dialog.show();
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM;
params.dimAmount =0.5f;
window.setAttributes(params);
}
}
示例8: getItemViewType
@Override public int getItemViewType(int position) {
Snap snap = mSnaps.get(position);
switch (snap.getGravity()) {
case Gravity.CENTER_VERTICAL:
return VERTICAL;
case Gravity.CENTER_HORIZONTAL:
return HORIZONTAL;
case Gravity.START:
return HORIZONTAL;
case Gravity.TOP:
return VERTICAL;
case Gravity.END:
return HORIZONTAL;
case Gravity.BOTTOM:
return VERTICAL;
}
return HORIZONTAL;
}
示例9: initViews
private void initViews() {
//initialize the viewpager
mViewPager = new ViewPager(mContext);
ViewPager.LayoutParams lp = new ViewPager.LayoutParams();
lp.width = ViewPager.LayoutParams.MATCH_PARENT;
lp.height = ViewPager.LayoutParams.MATCH_PARENT;
mViewPager.setLayoutParams(lp);
//initialize the indicator
mIndicator = new ViewPagerIndicator(mContext);
LayoutParams indicatorlp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
indicatorlp.gravity = Gravity.BOTTOM | Gravity.CENTER;
indicatorlp.bottomMargin = 20;
mIndicator.setLayoutParams(indicatorlp);
}
示例10: addDrag
public void addDrag(DragEdge dragEdge, View child, ViewGroup.LayoutParams params) {
if (child == null) return;
if (params == null) {
params = generateDefaultLayoutParams();
}
if (!checkLayoutParams(params)) {
params = generateLayoutParams(params);
}
int gravity = -1;
switch (dragEdge) {
case Left:
gravity = Gravity.LEFT;
break;
case Right:
gravity = Gravity.RIGHT;
break;
case Top:
gravity = Gravity.TOP;
break;
case Bottom:
gravity = Gravity.BOTTOM;
break;
}
if (params instanceof LayoutParams) {
((LayoutParams) params).gravity = gravity;
}
addView(child, 0, params);
}
示例11: 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;
}
示例12: 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;
}
示例13: initVideoView
private void initVideoView(Context context) {
mAppContext = context.getApplicationContext();
mSettings = new Settings(mAppContext);
initBackground();
initRenders();
addHttpHeader();
mVideoWidth = 0;
mVideoHeight = 0;
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
mCurrentState = STATE_IDLE;
mTargetState = STATE_IDLE;
subtitleDisplay = new TextView(context);
subtitleDisplay.setTextSize(24);
subtitleDisplay.setGravity(Gravity.CENTER);
LayoutParams layoutParams_txt = new LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT,
Gravity.BOTTOM);
addView(subtitleDisplay, layoutParams_txt);
}
示例14: onDraw
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (buttonDrawable != null) {
buttonDrawable.setState(getDrawableState());
final int verticalGravity = getGravity()
& Gravity.VERTICAL_GRAVITY_MASK;
final int height = buttonDrawable.getIntrinsicHeight();
int y = 0;
switch (verticalGravity) {
case Gravity.BOTTOM:
y = getHeight() - height;
break;
case Gravity.CENTER_VERTICAL:
y = (getHeight() - height) / 2;
break;
}
int buttonWidth = buttonDrawable.getIntrinsicWidth();
int buttonLeft = (getWidth() - buttonWidth) / 2;
buttonDrawable.setBounds(buttonLeft, y, buttonLeft + buttonWidth, y
+ height);
buttonDrawable.draw(canvas);
}
}
示例15: onCreateView
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//设置无标题
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
//设置从底部弹出
Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setAttributes(params);
return null;
}