當前位置: 首頁>>代碼示例>>Java>>正文


Java Gravity.START屬性代碼示例

本文整理匯總了Java中android.view.Gravity.START屬性的典型用法代碼示例。如果您正苦於以下問題:Java Gravity.START屬性的具體用法?Java Gravity.START怎麽用?Java Gravity.START使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.Gravity的用法示例。


在下文中一共展示了Gravity.START屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addWindow

static void addWindow(Application app) {
    activityLifecycleObservable = new ActivityLifecycleObservable();
    activityTaskView = new ActivityTaskView(app);
    activityTaskView.setObservable(activityLifecycleObservable);

    qhandler = new QueueHandler();

    WindowManager windowManager = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE);
    WindowManager.LayoutParams params = new WindowManager.LayoutParams();
    params.type = WindowManager.LayoutParams.TYPE_PHONE;
    params.format = PixelFormat.RGBA_8888;
    params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    params.width = WindowManager.LayoutParams.WRAP_CONTENT;
    params.height = WindowManager.LayoutParams.WRAP_CONTENT;
    params.gravity = Gravity.START | Gravity.TOP;
    params.x = 0;
    params.y = app.getResources().getDisplayMetrics().heightPixels;
    windowManager.addView(activityTaskView, params);

    app.registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
}
 
開發者ID:rome753,項目名稱:ActivityTaskView,代碼行數:21,代碼來源:ActivityTask.java

示例2: calculateDistanceToFinalSnap

public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager,
                                          @NonNull View targetView) {
    int[] out = new int[2];

    if (layoutManager.canScrollHorizontally()) {
        if (gravity == Gravity.START) {
            out[0] = distanceToStart(targetView, getHorizontalHelper(layoutManager), false);
        } else { // END
            out[0] = distanceToEnd(targetView, getHorizontalHelper(layoutManager), false);
        }
    } else {
        out[0] = 0;
    }

    if (layoutManager.canScrollVertically()) {
        if (gravity == Gravity.TOP) {
            out[1] = distanceToStart(targetView, getVerticalHelper(layoutManager), false);
        } else { // BOTTOM
            out[1] = distanceToEnd(targetView, getVerticalHelper(layoutManager), false);
        }
    } else {
        out[1] = 0;
    }

    return out;
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:26,代碼來源:GravityDelegate.java

示例3: setGravity

/**
 * Sets the horizontal alignment of the text and the
 * vertical gravity that will be used when there is extra space
 * in the TextView beyond what is required for the text itself.
 *
 * @see android.view.Gravity
 */
public boolean setGravity(int gravity) {
  if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
    gravity |= Gravity.START;
  }
  if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {
    gravity |= Gravity.TOP;
  }

  boolean newLayout = false;

  if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) !=
      (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK)) {
    newLayout = true;
  }

  if (gravity != mGravity) {
    newLayout = true;
  }

  mGravity = gravity;
  return newLayout;
}
 
開發者ID:lsjwzh,項目名稱:FastTextView,代碼行數:29,代碼來源:TextViewAttrsHelper.java

示例4: setButtonLayout

private void setButtonLayout(View buttonView, CFAlertActionButton actionButton) {
    LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    ;

    switch (actionButton.alignment) {
        case JUSTIFIED:
            buttonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            break;
        case START:
            buttonParams.gravity = Gravity.START;
            break;
        case CENTER:
            buttonParams.gravity = Gravity.CENTER;
            break;
        case END:
            buttonParams.gravity = Gravity.END;
            break;
    }

    buttonView.setLayoutParams(buttonParams);

    int padding = ((int) buttonView.getResources().getDimension(R.dimen.cfdialog_button_padding));
    buttonView.setPadding(padding, padding, padding, padding);
}
 
開發者ID:Codigami,項目名稱:CFAlertDialog,代碼行數:24,代碼來源:CFAlertDialog.java

示例5: createPopupLayout

private WindowManager.LayoutParams createPopupLayout(IBinder token) {
    WindowManager.LayoutParams p = new WindowManager.LayoutParams();
    p.gravity = Gravity.START | Gravity.TOP;
    p.width = ViewGroup.LayoutParams.MATCH_PARENT;
    p.height = ViewGroup.LayoutParams.MATCH_PARENT;
    p.format = PixelFormat.TRANSLUCENT;
    p.flags = computeFlags(p.flags);
    p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
    p.token = token;
    p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
    p.setTitle("DiscreteSeekBar Indicator:" + Integer.toHexString(hashCode()));

    return p;
}
 
開發者ID:tranleduy2000,項目名稱:screenfilter,代碼行數:14,代碼來源:PopupIndicator.java

示例6: 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

示例7: attachToRecyclerView

@Override
public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
        throws IllegalStateException {
    if (recyclerView != null) {
        if (mGravity == Gravity.START || mGravity == Gravity.END) {
            mIsRtlHorizontal = (recyclerView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
            // = recyclerView.getContext().getResources().getBoolean(R.bool.is_rtl);
        }
        if (mSnapListener != null) {
            recyclerView.addOnScrollListener(mScrollListener);
        }
    }
    super.attachToRecyclerView(recyclerView);
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:14,代碼來源:GravitySnapHelper.java

示例8: appleStyleAfterCreated

/**
 * Process view after created.
 *
 * @param editText
 */
protected void appleStyleAfterCreated(WXEditText editText) {
  String alignStr = (String) getDomObject().getStyles().get(Constants.Name.TEXT_ALIGN);
  int textAlign = getTextAlign(alignStr);
  if (textAlign <= 0) {
    textAlign = Gravity.START;
  }
  editText.setGravity(textAlign | getVerticalGravity());
  int colorInt = WXResourceUtils.getColor("#999999");
  if (colorInt != Integer.MIN_VALUE) {
    editText.setHintTextColor(colorInt);
  }

  editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, WXStyle.getFontSize(getDomObject().getStyles(),getInstance().getInstanceViewPortWidth()));
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:19,代碼來源:AbstractEditComponent.java

示例9: setIndicatorGravity

public BannerView setIndicatorGravity(int gravity) {
    if (mGravity != gravity) {
        if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
            gravity |= Gravity.START;
        }
        if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {
            gravity |= Gravity.TOP;
        }
        mGravity = gravity;
    }
    return this;
}
 
開發者ID:lany192,項目名稱:BannerView,代碼行數:12,代碼來源:BannerView.java

示例10: attachToRecyclerView

public void attachToRecyclerView(@NonNull RecyclerView recyclerView) {
    if (recyclerView != null) {
        if ((gravity == Gravity.START || gravity == Gravity.END)
                && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            isRtlHorizontal
                    = recyclerView.getContext().getResources().getConfiguration()
                    .getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
        }
        if (listener != null) {
            recyclerView.addOnScrollListener(mScrollListener);
        }
    }
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:13,代碼來源:GravityDelegate.java

示例11: 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:erguotou520,項目名稱:weex-uikit,代碼行數:14,代碼來源:AbstractEditComponent.java

示例12: init

private void init(Context context) {
    inflate(context, R.layout.detail_similar_movies_wrapper, this);
    ButterKnife.bind(this);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    SnapHelper snapHelper = new GravitySnapHelper(Gravity.START);
    snapHelper.attachToRecyclerView(recyclerView);
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
}
 
開發者ID:prakh25,項目名稱:MovieApp,代碼行數:14,代碼來源:SimilarMoviesWrapper.java

示例13: 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

示例14: setupTransitions

/**
 * Setup fragment transitions
 */
public void setupTransitions() {
    SidePropagation propagateBottom = new SidePropagation();
    propagateBottom.setSide(Gravity.BOTTOM);
    propagateBottom.setPropagationSpeed(2);

    SidePropagation propagateTop = new SidePropagation();
    propagateTop.setSide(Gravity.TOP);
    propagateTop.setPropagationSpeed(2);

    // Transition used for replacement fragments
    mNewEnterTransition = new Slide(Gravity.END);
    mNewEnterTransition.setPropagation(propagateBottom);
    mNewEnterTransition.setStartDelay(100);

    mNewExitTransition = new Slide(Gravity.END);
    mNewExitTransition.setPropagation(propagateBottom);
    mNewExitTransition.setStartDelay(0);

    // Transition used for main menu entering and exiting
    mMainExitTransition = new Slide(Gravity.START);
    mMainExitTransition.setPropagation(propagateTop);
    mMainExitTransition.setStartDelay(0);

    // Transition used for main menu reentering
    mMainReenterTransition = new Slide(Gravity.START);
    mMainReenterTransition.setPropagation(propagateTop);
    mMainReenterTransition.setStartDelay(200);

}
 
開發者ID:jaysondc,項目名稱:TripleTap,代碼行數:32,代碼來源:MainMenuFragment.java

示例15: initWindowParams

private void initWindowParams() {
    mWindowManager = (WindowManager) getApplication().getSystemService(WINDOW_SERVICE);
    mWindowParams = new WindowManager.LayoutParams();
    mWindowParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
    mWindowParams.format = PixelFormat.TRANSLUCENT;
    mWindowParams.flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    mWindowParams.gravity = Gravity.START | Gravity.TOP;
    mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
    mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
}
 
開發者ID:frowhy,項目名稱:Dominate,代碼行數:13,代碼來源:PpwButtonService.java


注:本文中的android.view.Gravity.START屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。