本文整理汇总了Java中android.support.design.widget.FloatingActionButton.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.getHeight方法的具体用法?Java FloatingActionButton.getHeight怎么用?Java FloatingActionButton.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.getHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFabTranslationForBottomNavigationBar
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
private void updateFabTranslationForBottomNavigationBar(CoordinatorLayout parent, FloatingActionButton fab, View dependency) {
float snackBarTranslation = getFabTranslationYForSnackBar(parent, fab);
float[] bottomBarParameters = getFabTranslationYForBottomNavigationBar(parent, fab);
float bottomBarTranslation = bottomBarParameters[0];
float bottomBarHeight = bottomBarParameters[1];
float targetTransY = 0;
if (snackBarTranslation >= bottomBarTranslation) {
// when snackBar is below BottomBar in translation present.
targetTransY = bottomBarTranslation;
} else {
targetTransY = snackBarTranslation;
}
// if (mFabBehaviour == BottomNavigationBar.FAB_BEHAVIOUR_DISAPPEAR) {
// if (targetTransY == 0) {
// fab.hide();
// } else {
// fab.show();
// }
// }
final float currentTransY = ViewCompat.getTranslationY(fab);
// Make sure that any current animation is cancelled
ensureOrCancelAnimator(fab);
if (fab.isShown()
&& Math.abs(currentTransY - targetTransY) > (fab.getHeight() * 0.667f)) {
// If the FAB will be travelling by more than 2/3 of it's height, let's animate it instead
mFabTranslationYAnimator.translationY(targetTransY).start();
} else {
// Now update the translation Y
ViewCompat.setTranslationY(fab, targetTransY);
}
}
示例2: revealSides
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@OnClick({R.id.first,R.id.third})
public void revealSides(FloatingActionButton dot) {
if (finished) {
finished=false;
lastDot = dot;
float deltaX = topPanel.getWidth() / 2 - dot.getX() - dot.getWidth() / 2;
float deltaY = topPanel.getHeight() / 2 - dot.getY() - dot.getHeight() / 2;
deltaY -= topPanel.getHeight() / 2 + getResources().getDimension(R.dimen.morph_radius) / 4;
Path arcPath = createArcPath(dot, deltaX, deltaY, -deltaX);
ValueAnimator pathAnimator = ValueAnimator.ofFloat(0, 1);
pathAnimator.addUpdateListener(new ArcListener(arcPath, dot));
int dotColor=dot.getBackgroundTintList().getDefaultColor();
topPanel.setBackgroundColor(dotColor);
if(dotColor==color) {
backgroundReveal().start();
}
pathAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
Animator animator = createRevealAnimator(dot, 0);
finish(animator);
animator.start();
runCloseAnimation();
}
});
AnimatorSet animatorSet = morphParent(duration(R.integer.reveal_duration));
animatorSet.play(pathAnimator);
addScaleAnimation(duration(R.integer.short_delay), duration(R.integer.fade_duration), animatorSet);
animatorSet.start();
}
}
示例3: createRevealAnimator
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
private Animator createRevealAnimator(FloatingActionButton dot, float offsetY){
ViewCompat.setElevation(dot,0);
dot.setVisibility(View.INVISIBLE);
lastDot=dot;
int cx=(int)(dot.getX()+dot.getHeight()/2);
int cy=(int)(dot.getY()+dot.getHeight()/2+offsetY);
int w = topPanel.getWidth();
int h = topPanel.getHeight();
final int endRadius = !isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
final int startRadius=isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
topPanel.setVisibility(View.VISIBLE);
Animator animator= ViewAnimationUtils.createCircularReveal(topPanel,cx,cy,startRadius,endRadius);
animator.setDuration(duration(R.integer.reveal_duration));
return animator;
}
示例4: onDependentViewChanged
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton fab, View dependency) {
if (dependency instanceof AppBarLayout) {
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
int fabBottomMargin = lp.bottomMargin;
int distanceToScroll = fab.getHeight() + fabBottomMargin;
float ratio = dependency.getY() /(float)toolbarHeight;
fab.setTranslationY(-distanceToScroll * ratio);
}
return true;
}
示例5: onDependentViewChanged
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton fab, View dependency) {
if (dependency instanceof AppBarLayout) {
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
int fabBottomMargin = lp.bottomMargin;
int distanceToScroll = fab.getHeight() + fabBottomMargin;
float ratio = (float)dependency.getY()/(float)toolbarHeight;
fab.setTranslationY(-distanceToScroll * ratio);
}
return true;
}
示例6: getDyBetweenChildAndDependency
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
/**
* In some <bold>WEIRD</bold> cases, mostly when you perform a little scroll but a fast one
* the {@link #onDependentViewChanged(CoordinatorLayout, FloatingActionButton, View)} DOESN'T
* reflect the real Y position of child mean the dependency get a better APROXIMATION of the real
* Y. This was causing that FAB some times doesn't get unhidden.
* @param child the FAB
* @param dependency NestedScrollView instance
* @return Dy betweens those 2 elements in Y, minus child's height/2
*/
private int getDyBetweenChildAndDependency(@NonNull FloatingActionButton child, @NonNull View dependency) {
if (dependency.getY() == 0 || dependency.getY() < offset)
return 0;
if ( (dependency.getY() - child.getY()) > child.getHeight() )
return Math.max(0, (int) ((dependency.getY() - (child.getHeight()/2)) - child.getY()) );
else
return 0;
}
示例7: onDependentViewChanged
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton fab, View dependency) {
boolean returnValue = super.onDependentViewChanged(parent, fab, dependency);
if (dependency instanceof AppBarLayout) {
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
int fabBottomMargin = lp.bottomMargin;
int distanceToScroll = fab.getHeight() + fabBottomMargin;
float ratio = dependency.getY() / (float) toolbarHeight;
fab.setTranslationY(-distanceToScroll * ratio);
}
return returnValue;
}
示例8: animation_change_color
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
public void animation_change_color(int Int) {
ImageView play_now_back_color = (ImageView) findViewById(R.id.play_now_back_color);
if (cx == 0) {
FloatingActionButton play_or_pause = (FloatingActionButton) findViewById(R.id.play_or_pause);
RelativeLayout seekbar_layout = (RelativeLayout) findViewById(R.id.seekbar_layout);
RelativeLayout control_layout = (RelativeLayout) findViewById(R.id.control_layout);
cx = play_or_pause.getLeft() + control_layout.getLeft() + play_or_pause.getWidth() / 2;
cy = control_layout.getTop() - seekbar_layout.getTop() + play_or_pause.getTop() + play_or_pause.getHeight() / 2;
finalRadius = Math.max(play_now_back_color.getWidth(), play_now_back_color.getHeight());
}
final int Int1 = Int;
final RelativeLayout activity_now_play = (RelativeLayout) findViewById(R.id.activity_now_play);
if (cx != 0) {
Animator anim = ViewAnimationUtils.createCircularReveal(play_now_back_color, cx, cy, 0, finalRadius);
play_now_back_color.setBackgroundColor(Int);
anim.setDuration(500);
anim.start();
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
activity_now_play.setBackgroundColor(Int1);
}
});
}else{
activity_now_play.setBackgroundColor(Int1);
}
TextView now_on_play_text = (TextView) findViewById(R.id.now_on_play_text);
now_on_play_text.setTextColor(Int);
//lrcview字体颜色
//歌词背景颜色
if(Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
View bottom = findViewById(R.id.gradient_bottom);
View top = findViewById(R.id.gradient_top);
View gradient = findViewById(R.id.gradient);
top.setBackground(
ScrimUtil.makeCubicGradientScrimDrawable(Int1, //颜色
8, //渐变层数
Gravity.TOP)); //起始方向
bottom.setBackground(
ScrimUtil.makeCubicGradientScrimDrawable(Int1, //颜色
8, //渐变层数
Gravity.BOTTOM)); //起始方向
gradient.setBackground(
ScrimUtil.makeCubicGradientScrimDrawable(Int1, //颜色
8, //渐变层数
Gravity.BOTTOM)); //起始方向
}
}