当前位置: 首页>>代码示例>>Java>>正文


Java Gravity.BOTTOM属性代码示例

本文整理汇总了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);
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:16,代码来源:GravitySnapHelper.java

示例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;
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:19,代码来源:FloatingCameraWindow.java

示例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;
}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:16,代码来源:VersionView.java

示例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);
}
 
开发者ID:NEYouFan,项目名称:ht-viewpagerwithindicator,代码行数:23,代码来源:HTViewPagerWithIndicator.java

示例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;
}
 
开发者ID:mangoblogger,项目名称:MangoBloggerAndroidApp,代码行数:24,代码来源:GravitySnapHelper.java

示例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));
    }
}
 
开发者ID:crazysunj,项目名称:Android-PickerDialog,代码行数:12,代码来源:PhoneOptionsPickerDialog.java

示例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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:MainActivity.java

示例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;
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:18,代码来源:SnapAdapter.java

示例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);
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:15,代码来源:BannerViewPager.java

示例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);
}
 
开发者ID:xieyangxuejun,项目名称:Views,代码行数:29,代码来源:SwipeLayout.java

示例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;
}
 
开发者ID:AriesHoo,项目名称:UIWidget,代码行数:18,代码来源:TitleBarView.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:GravityDelegate.java

示例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);
}
 
开发者ID:TongmingWu,项目名称:BLPlayer,代码行数:27,代码来源:IjkVideoView.java

示例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);
	}
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:27,代码来源:IndicatorRedRadioButton.java

示例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;
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:13,代码来源:BaseDialogFragment.java


注:本文中的android.view.Gravity.BOTTOM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。