当前位置: 首页>>代码示例>>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;未经允许,请勿转载。