當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。