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.onenews.widgets.sliding.MultiShrinkScroller.java
/** * This method must be called inside the Activity's onCreate. Initialize everything. *//*w ww . jav a 2 s. c om*/ public void initialize(MultiShrinkScrollerListener listener, boolean isOpenContactSquare) { scrollView = (ScrollView) findViewById(R.id.content_scroller); scrollViewChild = findViewById(R.id.content_container); toolbar = findViewById(R.id.toolbar_parent); photoViewContainer = findViewById(R.id.toolbar_parent); transparentView = findViewById(R.id.transparent_view); largeTextView = (TextView) findViewById(R.id.large_title); invisiblePlaceholderTextView = (TextView) findViewById(R.id.placeholder_textview); startColumn = findViewById(R.id.empty_start_column); // Touching the empty space should close the card if (startColumn != null) { startColumn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { scrollOffBottom(); } }); findViewById(R.id.empty_end_column).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { scrollOffBottom(); } }); } this.listener = listener; this.isOpenImageSquare = isOpenContactSquare; photoView = (ImageView) findViewById(R.id.photo); fab = (FloatingActionButton) findViewById(R.id.fab); titleGradientView = findViewById(R.id.title_gradient); titleGradientView.setBackgroundDrawable(titleGradientDrawable); actionBarGradientView = findViewById(R.id.action_bar_gradient); actionBarGradientView.setBackgroundDrawable(actionBarGradientDrawable); collapsedTitleStartMargin = ((Toolbar) findViewById(R.id.toolbar)).getContentInsetStart(); photoTouchInterceptOverlay = findViewById(R.id.photo_touch_intercept_overlay); if (!isTwoPanel) { photoTouchInterceptOverlay.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { expandHeader(); } }); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { scrollView.setOnScrollChangeListener(new OnScrollChangeListener() { @Override public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { updateFabStatus(scrollY); } }); } else { scrollView.getViewTreeObserver() .addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { updateFabStatus(scrollView.getScrollY()); } }); } } SchedulingUtils.doOnPreDraw(this, false, new Runnable() { @Override public void run() { if (!isTwoPanel) { maximumHeaderHeight = getResources().getDimensionPixelSize(R.dimen.sliding_header_max_height); intermediateHeaderHeight = (int) (maximumHeaderHeight * INTERMEDIATE_HEADER_HEIGHT_RATIO); } setHeaderHeight(getMaximumScrollableHeaderHeight()); maximumHeaderTextSize = largeTextView.getHeight(); if (isTwoPanel) { maximumHeaderHeight = getHeight(); minimumHeaderHeight = maximumHeaderHeight; intermediateHeaderHeight = maximumHeaderHeight; // Permanently set photo width and height. final ViewGroup.LayoutParams photoLayoutParams = photoViewContainer.getLayoutParams(); photoLayoutParams.height = maximumHeaderHeight; photoLayoutParams.width = (int) (maximumHeaderHeight * landscapePhotoRatio); photoViewContainer.setLayoutParams(photoLayoutParams); // Permanently set title width and margin. final LayoutParams largeTextLayoutParams = (LayoutParams) largeTextView.getLayoutParams(); largeTextLayoutParams.width = photoLayoutParams.width - largeTextLayoutParams.leftMargin - largeTextLayoutParams.rightMargin; largeTextLayoutParams.gravity = Gravity.BOTTOM | Gravity.START; largeTextView.setLayoutParams(largeTextLayoutParams); } else { // Set the width of largeTextView as if it was nested inside // photoViewContainer. largeTextView.setWidth(photoViewContainer.getWidth() - 2 * maximumTitleMargin); } calculateCollapsedLargeTitlePadding(); updateHeaderTextSizeAndMargin(); configureGradientViewHeights(); } }); }
From source file:com.google.blockly.android.ToolboxFragment.java
/** * @return True if {@link #mTabEdge} is {@link Gravity#TOP} or {@link Gravity#BOTTOM}. *///from w ww. j a v a 2 s.c o m protected boolean isTabsHorizontal() { return (mTabEdge == Gravity.TOP || mTabEdge == Gravity.BOTTOM); }
From source file:com.aidy.bottomdrawerlayout.AllDrawerLayout.java
/** * Enable or disable interaction with the given drawer. * //from ww w. ja v a2 s . co m * <p> * This allows the application to restrict the user's ability to open or * close the given drawer. DrawerLayout will still respond to calls to * {@link #openDrawer(int)}, {@link #closeDrawer(int)} and friends if a * drawer is locked. * </p> * * <p> * Locking a drawer open or closed will implicitly open or close that drawer * as appropriate. * </p> * * @param lockMode * The new lock mode for the given drawer. One of * {@link #LOCK_MODE_UNLOCKED}, {@link #LOCK_MODE_LOCKED_CLOSED} * or {@link #LOCK_MODE_LOCKED_OPEN}. * @param edgeGravity * Gravity.LEFT, RIGHT, START or END. Expresses which drawer to * change the mode for. * * @see #LOCK_MODE_UNLOCKED * @see #LOCK_MODE_LOCKED_CLOSED * @see #LOCK_MODE_LOCKED_OPEN */ public void setDrawerLockMode(int lockMode, int edgeGravity) { final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); final ViewDragHelper helper; switch (absGravity) { case Gravity.LEFT: mLockModeLeft = lockMode; helper = mLeftDragger; break; case Gravity.RIGHT: mLockModeRight = lockMode; helper = mRightDragger; break; case Gravity.TOP: mLockModeTop = lockMode; helper = mTopDragger; break; case Gravity.BOTTOM: mLockModeBottom = lockMode; helper = mBottomDragger; break; default: helper = mBottomDragger; break; } if (lockMode != LOCK_MODE_UNLOCKED) { // Cancel interaction in progress helper.cancel(); } switch (lockMode) { case LOCK_MODE_LOCKED_OPEN: final View toOpen = findDrawerWithGravity(absGravity); if (toOpen != null) { openDrawer(toOpen); } break; case LOCK_MODE_LOCKED_CLOSED: final View toClose = findDrawerWithGravity(absGravity); if (toClose != null) { closeDrawer(toClose); } break; // default: do nothing } }
From source file:com.microhealthllc.Slide.MultiShrinkScroller.java
/** * This method must be called inside the Activity's onCreate. Initialize everything. *//*from ww w .j a v a 2 s. c o m*/ public void initialize(MultiShrinkScrollerListener listener, boolean isOpenContactSquare) { scrollView = (ScrollView) findViewById(R.id.content_scroller); scrollViewChild = findViewById(R.id.content_container); toolbar = findViewById(R.id.toolbar_parent); photoViewContainer = findViewById(R.id.toolbar_parent); transparentView = findViewById(R.id.transparent_view); largeTextView = (TextView) findViewById(R.id.large_title); invisiblePlaceholderTextView = (TextView) findViewById(R.id.placeholder_textview); startColumn = findViewById(R.id.empty_start_column); // Touching the empty space should close the card if (startColumn != null) { startColumn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { scrollOffBottom(); } }); findViewById(R.id.empty_end_column).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { scrollOffBottom(); } }); } this.listener = listener; this.isOpenImageSquare = isOpenContactSquare; photoView = (ImageView) findViewById(R.id.photo); fab = (FloatingActionButton) findViewById(R.id.fab); titleGradientView = findViewById(R.id.title_gradient); titleGradientView.setBackgroundDrawable(titleGradientDrawable); actionBarGradientView = findViewById(R.id.action_bar_gradient); actionBarGradientView.setBackgroundDrawable(actionBarGradientDrawable); collapsedTitleStartMargin = ((Toolbar) findViewById(R.id.toolbar)).getContentInsetStart(); photoTouchInterceptOverlay = findViewById(R.id.photo_touch_intercept_overlay); if (!isTwoPanel) { photoTouchInterceptOverlay.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { expandHeader(); } }); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { scrollView.setOnScrollChangeListener(new OnScrollChangeListener() { @Override public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { updateFabStatus(scrollY); } }); } else { scrollView.getViewTreeObserver() .addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { updateFabStatus(scrollView.getScrollY()); } }); } } SchedulingUtils.doOnPreDraw(this, false, new Runnable() { @Override public void run() { if (!isTwoPanel) { maximumHeaderHeight = getResources().getDimensionPixelSize(R.dimen.sliding_header_max_height); intermediateHeaderHeight = (int) (maximumHeaderHeight * intermediateHeaderHeightRatio); } setHeaderHeight(getMaximumScrollableHeaderHeight()); maximumHeaderTextSize = largeTextView.getHeight(); if (isTwoPanel) { maximumHeaderHeight = getHeight(); minimumHeaderHeight = maximumHeaderHeight; intermediateHeaderHeight = maximumHeaderHeight; // Permanently set photo width and height. final ViewGroup.LayoutParams photoLayoutParams = photoViewContainer.getLayoutParams(); photoLayoutParams.height = maximumHeaderHeight; photoLayoutParams.width = (int) (maximumHeaderHeight * landscapePhotoRatio); photoViewContainer.setLayoutParams(photoLayoutParams); // Permanently set title width and margin. final LayoutParams largeTextLayoutParams = (LayoutParams) largeTextView.getLayoutParams(); largeTextLayoutParams.width = photoLayoutParams.width - largeTextLayoutParams.leftMargin - largeTextLayoutParams.rightMargin; largeTextLayoutParams.gravity = Gravity.BOTTOM | Gravity.START; largeTextView.setLayoutParams(largeTextLayoutParams); } else { // Set the width of largeTextView as if it was nested inside // photoViewContainer. largeTextView.setWidth(photoViewContainer.getWidth() - 2 * maximumTitleMargin); } calculateCollapsedLargeTitlePadding(); updateHeaderTextSizeAndMargin(); configureGradientViewHeights(); } }); }
From source file:com.taobao.weex.ui.view.refresh.core.WXSwipeLayout.java
/** * Init refresh view or loading view/*from w w w . java 2 s. c o m*/ */ private void setRefreshView() { // SetUp HeaderView FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, 0); headerView = new WXRefreshView(getContext()); headerView.setStartEndTrim(0, 0.75f); headerView.setBackgroundColor(mRefreshViewBgColor); headerView.setProgressBgColor(mProgressBgColor); headerView.setProgressColor(mProgressColor); headerView.setContentGravity(Gravity.BOTTOM); addView(headerView, lp); // SetUp FooterView lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, 0); lp.gravity = Gravity.BOTTOM; footerView = new WXRefreshView(getContext()); footerView.setStartEndTrim(0.5f, 1.25f); footerView.setBackgroundColor(mRefreshViewBgColor); footerView.setProgressBgColor(mProgressBgColor); footerView.setProgressColor(mProgressColor); footerView.setContentGravity(Gravity.TOP); addView(footerView, lp); }
From source file:com.klinker.android.sliding.MultiShrinkScroller.java
/** * This method must be called inside the Activity's onCreate. Initialize everything. *///from ww w . j a v a 2 s . c o m public void initialize(MultiShrinkScrollerListener listener, boolean isOpenContactSquare) { scrollView = (NestedScrollView) findViewById(R.id.content_scroller); scrollViewChild = findViewById(R.id.content_container); toolbar = findViewById(R.id.toolbar_parent); photoViewContainer = findViewById(R.id.toolbar_parent); transparentView = findViewById(R.id.transparent_view); largeTextView = (TextView) findViewById(R.id.large_title); invisiblePlaceholderTextView = (TextView) findViewById(R.id.placeholder_textview); startColumn = findViewById(R.id.empty_start_column); // Touching the empty space should close the card if (startColumn != null) { startColumn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { scrollOffBottom(); } }); findViewById(R.id.empty_end_column).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { scrollOffBottom(); } }); } this.listener = listener; this.isOpenImageSquare = isOpenContactSquare; photoView = (ImageView) findViewById(R.id.photo); fab = (FloatingActionButton) findViewById(R.id.fab); titleGradientView = findViewById(R.id.title_gradient); titleGradientView.setBackgroundDrawable(titleGradientDrawable); actionBarGradientView = findViewById(R.id.action_bar_gradient); actionBarGradientView.setBackgroundDrawable(actionBarGradientDrawable); collapsedTitleStartMargin = ((Toolbar) findViewById(R.id.toolbar)).getContentInsetStart(); photoTouchInterceptOverlay = findViewById(R.id.photo_touch_intercept_overlay); if (!isTwoPanel) { photoTouchInterceptOverlay.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { expandHeader(); } }); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { scrollView.setOnScrollChangeListener(new OnScrollChangeListener() { @Override public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { updateFabStatus(scrollY); } }); } else { scrollView.getViewTreeObserver() .addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { updateFabStatus(scrollView.getScrollY()); } }); } } SchedulingUtils.doOnPreDraw(this, false, new Runnable() { @Override public void run() { if (!isTwoPanel) { maximumHeaderHeight = getResources().getDimensionPixelSize(R.dimen.sliding_header_max_height); intermediateHeaderHeight = (int) (maximumHeaderHeight * intermediateHeaderHeightRatio); } setHeaderHeight(getMaximumScrollableHeaderHeight()); maximumHeaderTextSize = largeTextView.getHeight(); if (isTwoPanel) { maximumHeaderHeight = getHeight(); minimumHeaderHeight = maximumHeaderHeight; intermediateHeaderHeight = maximumHeaderHeight; // Permanently set photo width and height. final ViewGroup.LayoutParams photoLayoutParams = photoViewContainer.getLayoutParams(); photoLayoutParams.height = maximumHeaderHeight; photoLayoutParams.width = (int) (maximumHeaderHeight * landscapePhotoRatio); photoViewContainer.setLayoutParams(photoLayoutParams); // Permanently set title width and margin. final LayoutParams largeTextLayoutParams = (LayoutParams) largeTextView.getLayoutParams(); largeTextLayoutParams.width = photoLayoutParams.width - largeTextLayoutParams.leftMargin - largeTextLayoutParams.rightMargin; largeTextLayoutParams.gravity = Gravity.BOTTOM | Gravity.START; largeTextView.setLayoutParams(largeTextLayoutParams); } else { // Set the width of largeTextView as if it was nested inside // photoViewContainer. largeTextView.setWidth(photoViewContainer.getWidth() - 2 * maximumTitleMargin); } calculateCollapsedLargeTitlePadding(); updateHeaderTextSizeAndMargin(); configureGradientViewHeights(); } }); }
From source file:com.actionbarsherlock.custom.widget.VerticalDrawerLayout.java
/** * Check the lock mode of the given drawer view. * * @param drawerView Drawer view to check lock mode * @return one of {@link #LOCK_MODE_UNLOCKED}, {@link #LOCK_MODE_LOCKED_CLOSED} or * {@link #LOCK_MODE_LOCKED_OPEN}. *//*from w w w .ja v a 2 s . com*/ public int getDrawerLockMode(View drawerView) { final int gravity = getDrawerViewGravity(drawerView); if (gravity == Gravity.TOP) { return mLockModeTop; } else if (gravity == Gravity.BOTTOM) { return mLockModeBottom; } return LOCK_MODE_UNLOCKED; }
From source file:com.alirezaafkar.toolbar.ToolbarWidgetWrapper.java
@Override public void setNavigationMode(int mode) { final int oldMode = mNavigationMode; if (mode != oldMode) { switch (oldMode) { case ActionBar.NAVIGATION_MODE_LIST: if (mSpinner != null && mSpinner.getParent() == mToolbar) { mToolbar.removeView(mSpinner); }/*from w w w . ja va 2 s.com*/ break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null && mTabView.getParent() == mToolbar) { mToolbar.removeView(mTabView); } break; } mNavigationMode = mode; switch (mode) { case ActionBar.NAVIGATION_MODE_STANDARD: break; case ActionBar.NAVIGATION_MODE_LIST: ensureSpinner(); mToolbar.addView(mSpinner, 0); break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null) { mToolbar.addView(mTabView, 0); RtlToolbar.LayoutParams lp = (RtlToolbar.LayoutParams) mTabView.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.START | Gravity.BOTTOM; } break; default: throw new IllegalArgumentException("Invalid navigation mode " + mode); } } }
From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DataSource.createIcons(getResources()); try {//from w w w . j a v a2s. c o m // ?? final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); // ? ?? ? this.mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "My Tag"); // ?? locationMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // ?? . 2 ?? (1/1000s), 3 ?? (m)? ? locationMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 3, this); //orientation sensor sensorMgr_ori = (SensorManager) getSystemService(Context.SENSOR_SERVICE); orientationSensor = sensorMgr_ori.getDefaultSensor(Sensor.TYPE_ORIENTATION); killOnError(); // ? ? requestWindowFeature(Window.FEATURE_NO_TITLE); // ? ? // ?? FrameLayout frameLayout = new FrameLayout(this); // ? ?, ? frameLayout.setMinimumWidth(3000); frameLayout.setPadding(10, 0, 10, 10); // ? ? ? ?? ? camScreen = new CameraSurface(this); augScreen = new AugmentedView(this); setContentView(camScreen); // ? ?? ? ? // ? ?? ? addContentView(augScreen, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); // ? ? ? ? ?. // ? ? ? ?? ? ? ? addContentView(frameLayout, new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM)); topLayoutOnMixView = new TopLayoutOnMixView(this); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); addContentView(topLayoutOnMixView.mainArView, params); // ? ? ? topLayoutOnMixView ? ? handleIntent(getIntent()); // ?? // ? ? ? if (!isInited) { mixContext = new MixContext(this); // ? ? // ? ? mixContext.downloadManager = new DownloadManager(mixContext); //? ? ? navigator = new Navigator(mixContext, topLayoutOnMixView.naverFragment); // ? ? ?? ? ? dWindow = new PaintScreen(); dataView = new DataView(mixContext); isInited = true; // true } if (mixContext.isActualLocation() == false) { Toast.makeText(this, getString(DataView.CONNECTION_GPS_DIALOG_TEXT), Toast.LENGTH_LONG).show(); } } catch (Exception ex) { doError(ex); // ? ? } // ? IntentFilter naviBraodFilter = new IntentFilter(); naviBraodFilter.addAction("NAVI"); registerReceiver(naviRecevicer, naviBraodFilter); }
From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java
@Override public void setNavigationMode(int mode) { final int oldMode = mNavigationMode; if (mode != oldMode) { switch (oldMode) { case ActionBar.NAVIGATION_MODE_LIST: if (mSpinner != null && mSpinner.getParent() == mToolbar) { mToolbar.removeView(mSpinner); }//from www . jav a 2s. c om break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null && mTabView.getParent() == mToolbar) { mToolbar.removeView(mTabView); } break; } mNavigationMode = mode; switch (mode) { case ActionBar.NAVIGATION_MODE_STANDARD: break; case ActionBar.NAVIGATION_MODE_LIST: ensureSpinner(); mToolbar.addView(mSpinner, 0); break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabView != null) { mToolbar.addView(mTabView, 0); Toolbar.LayoutParams lp = (Toolbar.LayoutParams) mTabView.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.START | Gravity.BOTTOM; } break; default: throw new IllegalArgumentException("Invalid navigation mode " + mode); } } }