android.view.ViewGroup#setTranslationY ( )源码实例Demo

下面列出了android.view.ViewGroup#setTranslationY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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);
}
 
源代码2 项目: Depth   文件: RootActivity.java
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);
}
 
源代码3 项目: Depth   文件: RootActivity.java
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);
}
 
源代码4 项目: Android-Plugin-Framework   文件: RootActivity.java
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);
}
 
 方法所在类