Java Code Examples for android.view.ViewGroup#setTranslationY()

The following examples show how to use android.view.ViewGroup#setTranslationY() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected void onBottomSheetChanged(
    CoordinatorLayout parent, ViewGroup layout, BottomSheetMetrics metrics) {
  ViewGroup toolbarWrapper = layout.findViewById(R.id.toolbar_wrapper);
  View bottomSheetScrim = layout.findViewById(R.id.bottom_sheet_bottom_inset_scrim);
  View hamburgerButton = parent.findViewById(R.id.hamburger_btn);
  View mapScrim = parent.findViewById(R.id.map_scrim);

  // Fade in the bottom scrim and "Add Observation" button, with both being fully visible as soon
  // as the top of the bottom sheet passes the top of the "Add Observation" button.
  float revealRatio = metrics.getRevealRatio();
  float hideRatio = 1.0f - revealRatio;
  layout.setAlpha(revealRatio);
  mapScrim.setAlpha(metrics.getExpansionRatio());
  bottomSheetScrim.setAlpha(revealRatio);
  toolbarWrapper.setAlpha(revealRatio);
  toolbarWrapper.setTranslationY(-toolbarWrapper.getHeight() * hideRatio);
  hamburgerButton.setAlpha(hideRatio);
}
 
Example 2
Source Project: Depth   File: RootActivity.java    License: MIT License 5 votes vote down vote up
private void setupMenu() {
    menu = (ViewGroup) findViewById(R.id.menu_container);
    int color = getResources().getColor(R.color.splash1);
    addMenuItem(menu, "Water And Noise", R.drawable.splash1, color, R.drawable.menu_btn, 0);
    addMenuItem(menu, "Two Bears", R.drawable.splash2, getResources().getColor(R.color.splash2), R.drawable.menu_btn2, 1);
    addMenuItem(menu, "Depth Playground", R.drawable.splash3, getResources().getColor(R.color.splash3), R.drawable.menu_btn3, 2);
    addMenuItem(menu, "About", R.drawable.splash4, getResources().getColor(R.color.splash4), R.drawable.menu_btn4, 3);
    selectMenuItem(0, color);
    menu.setTranslationY(20000);
}
 
Example 3
Source Project: Depth   File: RootActivity.java    License: MIT License 5 votes vote down vote up
private void setupMenu() {
    menu = (ViewGroup) findViewById(R.id.menu_container);
    int color = getResources().getColor(R.color.splash1);
    addMenuItem(menu, "Water And Noise", R.drawable.splash1, color, R.drawable.menu_btn, 0);
    addMenuItem(menu, "Two Bears", R.drawable.splash2, getResources().getColor(R.color.splash2), R.drawable.menu_btn2, 1);
    addMenuItem(menu, "Depth Playground", R.drawable.splash3, getResources().getColor(R.color.splash3), R.drawable.menu_btn3, 2);
    addMenuItem(menu, "About", R.drawable.splash4, getResources().getColor(R.color.splash4), R.drawable.menu_btn4, 3);
    selectMenuItem(0, color);
    menu.setTranslationY(20000);
}
 
Example 4
Source Project: Android-Plugin-Framework   File: RootActivity.java    License: MIT License 5 votes vote down vote up
private void setupMenu() {
  menu = (ViewGroup) findViewById(R.id.menu_container);
  int color = getResources().getColor(R.color.splash1);
  addMenuItem(menu, "Water And Noise", R.drawable.splash1, color, R.drawable.menu_btn, 0);
  addMenuItem(menu, "Two Bears", R.drawable.splash2, getResources().getColor(R.color.splash2),
      R.drawable.menu_btn2, 1);
  addMenuItem(menu, "Depth Playground", R.drawable.splash3,
      getResources().getColor(R.color.splash3), R.drawable.menu_btn3, 2);
  addMenuItem(menu, "About", R.drawable.splash4, getResources().getColor(R.color.splash4),
      R.drawable.menu_btn4, 3);
  selectMenuItem(0, color);
  menu.setTranslationY(20000);
}