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

The following examples show how to use android.view.ViewGroup#setTranslationY() . 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
Source File: FeatureDetailsChromeBehavior.java    From ground-android with Apache License 2.0 6 votes vote down vote up
@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 File: RootActivity.java    From Depth with 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 File: RootActivity.java    From Depth with 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 File: RootActivity.java    From Android-Plugin-Framework with 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);
}