List of usage examples for android.view Gravity BOTTOM
int BOTTOM
To view the source code for android.view Gravity BOTTOM.
Click Source Link
From source file:com.ayoview.sample.textview.badge.ViewsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.badge_fragment_views, null); View backgroundDefaultView = layout.findViewById(R.id.backgroundDefault); backgroundDefaultBadge = new BadgeView(getActivity()); backgroundDefaultBadge.setBadgeCount(42); backgroundDefaultBadge.setTargetView(backgroundDefaultView); View backgroundDrawableView = layout.findViewById(R.id.backgroundDrawable); backgroundDrawableBadge = new BadgeView(getActivity()); backgroundDrawableBadge.setBadgeCount(88); backgroundDrawableBadge.setBackgroundResource(R.drawable.badge_blue); backgroundDrawableBadge.setTargetView(backgroundDrawableView); View backgroundShapeView = layout.findViewById(R.id.backgroundShape); backgroundShapeBadge = new BadgeView(getActivity()); backgroundShapeBadge.setBadgeCount(47); backgroundShapeBadge.setBackground(12, Color.parseColor("#9b2eef")); backgroundShapeBadge.setTargetView(backgroundShapeView); View counterView = layout.findViewById(R.id.counter); counterView.setOnClickListener(this); counterBadge = new BadgeView(getActivity()); counterBadge.setBadgeCount(-2);/* w w w . java 2s. c o m*/ counterBadge.setTargetView(counterView); View gravityView = layout.findViewById(R.id.gravity); gravityView.setOnClickListener(this); gravityBadge = new BadgeView(getActivity()); gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.BOTTOM); gravityBadge.setBadgeCount(4); gravityBadge.setTargetView(gravityView); View textStyleView = layout.findViewById(R.id.textStyle); textStyleView.setOnClickListener(this); textStyleBadge = new BadgeView(getActivity()); textStyleBadge.setBadgeCount(18); textStyleBadge.setTargetView(textStyleView); textStyleBadge.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC)); textStyleBadge.setShadowLayer(2, -1, -1, Color.GREEN); View visibilityView = layout.findViewById(R.id.visibility); visibilityView.setOnClickListener(this); visibilityBadgeView = new BadgeView(getActivity()); visibilityBadgeView.setBadgeCount(1); visibilityBadgeView.setTargetView(visibilityView); return layout; }
From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java
@UiThread public void showToast(String message) { Toast toast = Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show();//from w w w . j a v a2 s .co m }
From source file:com.lokiy.widget.BannerView.java
public BannerView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BannerView); isShowIndicator = a.getBoolean(R.styleable.BannerView_showIndicator, true); mIndicatorId = a.getResourceId(R.styleable.BannerView_indicator, 0); isCorner = a.getBoolean(R.styleable.BannerView_corner, false); mRectRoundRadius = a.getDimensionPixelOffset(R.styleable.BannerView_cornerRadii, 0); mPageMargin = a.getDimensionPixelSize(R.styleable.BannerView_pageMargin, 0); int mIndicatorGravity = a.getInt(R.styleable.BannerView_indicator_gravity, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM); a.recycle();//from w ww .j av a 2 s.c o m mViewPager = new XViewPager(getContext(), null); mViewPager.setPageMargin(mPageMargin); setClipChildren(false); mAdapter = new BannerAdapter(); //noinspection deprecation mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageSelected(int position) { position = position % mAdapter.getRealCount(); if (isShowIndicator) { vRadioGroup.check(position); } if (onPageSelectedListener != null) { onPageSelectedListener.onPageSelected(position, mAdapter.mBannerList.get(position)); } } @Override public void onPageScrollStateChanged(int position) { } }); mViewPager.setAdapter(mAdapter); addView(mViewPager, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); if (isShowIndicator) { vRadioGroup = new RadioGroup(getContext()); LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.gravity = mIndicatorGravity; vRadioGroup.setGravity(Gravity.CENTER); vRadioGroup.setOrientation(LinearLayout.HORIZONTAL); addView(vRadioGroup, params); } }
From source file:com.frostwire.android.gui.util.UIUtils.java
private static void showToastMessage(Context context, String message, int duration, int gravity, int xOffset, int yOffset) { if (context != null && message != null) { Toast toast = Toast.makeText(context, message, duration); if (gravity != (Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM)) { toast.setGravity(gravity, xOffset, yOffset); }//from w ww .ja v a 2 s. com toast.show(); } }
From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java
@UiThread public void showToastLong(String message) { Toast toast = Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show();//from w w w .ja v a 2s . co m }
From source file:com.amitupadhyay.aboutexample.ui.widget.FabOverlapTextView.java
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FabOverlapTextView); float defaultTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, DEFAULT_TEXT_SIZE_SP, getResources().getDisplayMetrics()); setFabOverlapGravity(a.getInt(R.styleable.FabOverlapTextView_fabGravity, Gravity.BOTTOM | Gravity.RIGHT)); setFabOverlapHeight(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_fabOverlayHeight, 0)); setFabOverlapWidth(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_fabOverlayWidth, 0)); if (a.hasValue(R.styleable.FabOverlapTextView_android_textAppearance)) { final int textAppearance = a.getResourceId(R.styleable.FabOverlapTextView_android_textAppearance, android.R.style.TextAppearance); TypedArray atp = getContext().obtainStyledAttributes(textAppearance, R.styleable.FontTextAppearance); paint.setColor(atp.getColor(R.styleable.FontTextAppearance_android_textColor, Color.BLACK)); paint.setTextSize(atp.getDimensionPixelSize(R.styleable.FontTextAppearance_android_textSize, (int) defaultTextSize)); if (atp.hasValue(R.styleable.FontTextAppearance_font)) { paint.setTypeface(FontUtil.get(getContext(), atp.getString(R.styleable.FontTextAppearance_font))); }//ww w .j av a2s . co m atp.recycle(); } if (a.hasValue(R.styleable.FabOverlapTextView_font)) { setFont(a.getString(R.styleable.FabOverlapTextView_font)); } if (a.hasValue(R.styleable.FabOverlapTextView_android_textColor)) { setTextColor(a.getColor(R.styleable.FabOverlapTextView_android_textColor, 0)); } if (a.hasValue(R.styleable.FabOverlapTextView_android_textSize)) { setTextSize(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_android_textSize, (int) defaultTextSize)); } lineHeightHint = a.getDimensionPixelSize(R.styleable.FabOverlapTextView_lineHeightHint, 0); unalignedTopPadding = getPaddingTop(); unalignedBottomPadding = getPaddingBottom(); breakStrategy = a.getInt(R.styleable.FabOverlapTextView_android_breakStrategy, Layout.BREAK_STRATEGY_BALANCED); a.recycle(); }
From source file:com.example.tt.pullrefresh.widget.SwipItemLayout.java
@Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (sheet != null) { throw new UnsupportedOperationException("CurveLayout must only have 1 child view"); }//from w w w .j av a 2s.c o m sheet = child; sheet.addOnLayoutChangeListener(sheetLayout); // force the sheet contents to be gravity bottom. This ain't a top sheet. ((LayoutParams) params).gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; super.addView(child, index, params); }
From source file:am.project.x.business.drawables.cornerdrawable.CornerDrawableActivity.java
@SuppressLint("RtlHardcoded") @Override// w w w . j a v a 2 s.com public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (parent.getId()) { case R.id.cnd_sp_direction: switch (position) { default: case 0: drawable.setDirection(Gravity.TOP); break; case 1: drawable.setDirection(Gravity.LEFT); break; case 2: drawable.setDirection(Gravity.RIGHT); break; case 3: drawable.setDirection(Gravity.BOTTOM); break; } break; case R.id.cnd_sp_location: switch (position) { default: case 0: drawable.setLocation(Gravity.CENTER); break; case 1: drawable.setLocation(Gravity.LEFT); break; case 2: drawable.setLocation(Gravity.RIGHT); break; } break; } }
From source file:com.citrus.sample.UIActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_ui); activity = this; app_name = getResources().getString(R.string.app_name); frameLayout = (FrameLayout) findViewById(R.id.container); fragmentManager = getSupportFragmentManager(); citrusClient = CitrusClient.getInstance(mContext); citrusClient.enableLog(Constants.enableLogging); initCitrusClient();//from ww w . j av a 2 s .c o m citrusClient.enableAutoOtpReading(true); citrusConfig = CitrusConfig.getInstance(); citrusConfig.setColorPrimary(Constants.colorPrimary); citrusConfig.setColorPrimaryDark(Constants.colorPrimaryDark); citrusConfig.setTextColorPrimary(Constants.textColor); citrusConfig.enableOneTapPayment(Constants.ENABLE_ONE_TAP_PAYMENT); showUI(); snackBarParent = new View(this); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, 200); layoutParams.gravity = Gravity.BOTTOM; snackBarParent.setLayoutParams(layoutParams); frameLayout.addView(snackBarParent); }
From source file:com.guess.license.plate.Task.LoadingTaskConn.java
@Override protected void onPostExecute(ServerError result) { super.onPostExecute(result); loadingDialog.dismiss();// ww w . j a v a 2 s.c o m if (result != null && !result.equals(ServerError.NO_ERROR)) { Toast toast = Toast.makeText(context, Language.GetServerErrorLanguage(result, context), Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); } new CountDownTimer(TIMER, 1000) { public void onTick(long millisUntilFinished) { // Do nothing } public void onFinish() { activity.onTaskFinished(); } }.start(); }