android.support.v7.widget.Toolbar.setAlpha()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中android.support.v7.widget.Toolbar.setAlpha()方法的一些代码示例,展示了Toolbar.setAlpha()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setAlpha()方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setAlpha

Toolbar.setAlpha介绍

暂无

代码示例

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
      public void onHeaderMoving(RefreshHeader header, boolean isDragging, float percent, int offset, int headerHeight, int maxDragHeight) {
        mOffset = offset / 2;
        parallax.setTranslationY(mOffset - mScrollY);
        toolbar.setAlpha(1 - Math.min(percent, 1));
      }
//            @Override

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
      public void onHeaderMoving(RefreshHeader header, boolean isDragging, float percent, int offset, int headerHeight, int maxDragHeight) {
        toolbar.setAlpha(1 - Math.min(percent, 1));
        floor.setTranslationY(Math.min(offset - floor.getHeight() + toolbar.getHeight(), refreshLayout.getLayout().getHeight() - floor.getHeight()));
      }
//            @Override

代码示例来源:origin: xinghongfei/LookLook

mToolbar.setAlpha(0.3f);

代码示例来源:origin: eclipse/paho.mqtt.android

@Override
  public void onDrawerSlide(View drawerView, float slideOffset) {
    super.onDrawerSlide(drawerView, slideOffset);
    toolbar.setAlpha(1 - slideOffset / 2);
  }
};

代码示例来源:origin: rajeeviiit/AndroidProject

@Override
      public void onDrawerSlide(View drawerView, float slideOffset) {
//                Log.d("Rajeev", "offset" +slideOffset);
//                super.onDrawerSlide(drawerView, slideOffset);
        if (slideOffset < 0.6) {
          toolbar.setAlpha(1 - slideOffset);
        }
      }
    };

代码示例来源:origin: JmStefanAndroid/EasyBehavior

@Override
public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
  mToolBar.setAlpha(Float.valueOf(Math.abs(i)) / Float.valueOf(appBarLayout.getTotalScrollRange()));
}

代码示例来源:origin: PhilippeBoisney/SimpleDroidRx

@Override
  public void onDrawerSlide(View drawerView, float slideOffset) {
    super.onDrawerSlide(drawerView, slideOffset);
    toolbar.setAlpha(1 - slideOffset / 2);
  }
};

代码示例来源:origin: GitLqr/MaterialDesignDemo

@Override
  public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    View childAt = view.getChildAt(0);
    if (childAt == null)
      return;
    int scrollY = firstVisibleItem * childAt.getHeight() - childAt.getTop();
    if (scrollY <= (mScreenHeight / 3f)) {
      float alpha = 1f - (scrollY / (mScreenHeight / 3f));
      Log.e("CSDN_LQR", "scrollY = " + scrollY);
      Log.e("CSDN_LQR", "alpha = " + alpha);
      mToolbar.setAlpha(alpha);
    }
  }
}

代码示例来源:origin: Vegen/SmartCampus

@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
  int absVerticalOffset = Math.abs(verticalOffset);
  float alpha = (float) absVerticalOffset / banner.getHeight();
  if (alpha > 1) alpha = 1;
  toolbar.setAlpha(alpha);
  if (alpha == 0) {
    swipeRefreshLayout.setEnabled(true);
  } else {
    swipeRefreshLayout.setEnabled(false);
  }
}

代码示例来源:origin: tony-Shx/Swface

private void showTitleAndMenu(Point globalOffset) {
  linearLayout_contains.setVisibility(View.GONE);
  toolbar.setTitle(userHasSigned.getUser_name());
  toolbar.setSubtitle("注册时间:" + userHasSigned.getCreated_at());
  toolbar.setAlpha(1.0f);
  Rect finnal_toobar = new Rect();
  Rect finnal_liner_bottom = new Rect();
  toolbar.getGlobalVisibleRect(finnal_toobar);
  linearLayout_bottom.getGlobalVisibleRect(finnal_liner_bottom);
  Log.i(TAG, "showTitleAndMenu: " + finnal_liner_bottom.toString() + finnal_toobar.toString());
  finnal_toobar.offset(-globalOffset.x, -globalOffset.y);
  finnal_liner_bottom.offset(-globalOffset.x, -globalOffset.y);
  Log.i(TAG, "showTitleAndMenu: " + finnal_liner_bottom.toString() + finnal_toobar.toString());
  linearLayout_bottom.setAlpha(1.0f);
  AnimatorSet set1 = new AnimatorSet();
  set1.play(ObjectAnimator.ofFloat(toolbar, View.Y, -finnal_toobar.height(), 0.0f))
      //(1280+finnal_liner_bottom.top)/2
      .with(ObjectAnimator.ofFloat(linearLayout_bottom, View.Y, finnal_liner_bottom.bottom, finnal_liner_bottom.top));
  set1.setDuration(400);
  set1.start();
}

相关文章

Toolbar类方法