本文整理汇总了Java中android.widget.RelativeLayout.getLeft方法的典型用法代码示例。如果您正苦于以下问题:Java RelativeLayout.getLeft方法的具体用法?Java RelativeLayout.getLeft怎么用?Java RelativeLayout.getLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.getLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDependentViewChanged
import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, RelativeLayout child, View dependency) {
Toast.makeText(context, "changed", Toast.LENGTH_SHORT).show();
if ((dependency.getLeft() < child.getLeft() && child.getLeft() < dependency.getRight()) ||
(dependency.getLeft() < child.getRight() && child.getRight() < dependency.getRight())) {
float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
child.setTranslationY(-400);
// value = value - 100;
// TranslateAnimation translateAnimation = new TranslateAnimation(0, 0,0, value);
// translateAnimation.setFillAfter(true);
// child.startAnimation(translateAnimation);
}
return true;
}
示例2: animation_change_color
import android.widget.RelativeLayout; //导入方法依赖的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)); //起始方向
}
}