我试图从屏幕底部滑动一个视图并折叠另一个视图,一切都会正确适合。
我设法使用属性SELECT new_mprnnumber,
new_customernumber,
MAX(b.billingPeriodEndDate) as 'Billed up to date'
FROM [CRM].[crm4_MSCRM].[dbo].[AccountExtensionBase] as a
inner join Billing.dbo.bill as b
on a.new_mprnnumber = b.MPRN
where new_accountstage = 7
and new_accounttype = 2
group by new_mprnnumber,
new_customernumber
GO
和2个简单的xml动画animateLayoutChanges
和slid_up.xml
。
我的问题是,属性slid_down.xml
中ViewPager
发生的动画并不顺畅。
有没有办法解决这个问题?
slid_up.xml
animateLayoutChanges
slid_down.xml
<translate
android:duration="1000"
android:fromYDelta="100%"
android:toYDelta="0" />
</set>
P.S。我曾尝试将自定义动画师创建为高度动画师,但它与视图的原始高度相混淆。
HeightResizeAnimation
<translate
android:duration="1000"
android:fromYDelta="0"
android:toYDelta="100%" />
</set>
在动画之后,高度将不再是动画之前的public class HeightResizeAnimation extends Animation {
private View mView;
private float mToHeight;
private float mFromHeight;
private int duration = 300;
public HeightResizeAnimation(View v, float offset) {
mView = v;
mToHeight = v.getHeight() + offset;
mFromHeight = v.getHeight();
setDuration(duration);
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float newHeight = (mToHeight - mFromHeight) * interpolatedTime + mFromHeight;
mView.getLayoutParams().height = (int) newHeight;
mView.requestLayout();
}
}
。
你可以看到底部的fab动画对于fab是孩子的viewpager来说也不平滑
答案 0 :(得分:1)
好像你只是想展示一个小吃吧+随着它展示FAB一起移动它? 为此,您可以使用Android支持库中的Snackbar和CoordinatorLayout的组合:http://www.androidhive.info/2015/09/android-material-design-snackbar-example/
答案 1 :(得分:1)
在xml布局中,在视图中添加以下内容:
android:visibility="gone"
android:alpha="0"
android:id="@+id/text_view_liked"
我认为视图为TextView
。
点击ImageView
点击为text_view_liked
设置动画,其中包含以下内容:
final TextView textViewLiked = (TextView) findViewById(R.id.text_view_get_liked);
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
PropertyValuesHolder pvhYTextViewLiked = PropertyValuesHolder
.ofFloat(View.Y,
textViewLiked.getBottom(),
(textViewLiked.getBottom() - textViewLiked.getHeight()));
PropertyValuesHolder pvhAlphaTextViewLiked = PropertyValuesHolder
.ofFloat(View.ALPHA, 0f, 1f);
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(textViewLiked,
pvhYTextViewLiked,
pvhAlphaTextViewLiked);
ObjectAnimator objectAnimatorFab = ObjectAnimator.ofFloat(fab, View.Y, fab.getY(),
fab.getY() - textViewLiked.getHeight());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(objectAnimator).with(objectAnimatorFab);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
textViewLiked.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
PropertyValuesHolder pvhYTextViewLiked = PropertyValuesHolder
.ofFloat(View.Y,
textViewLiked.getTop(),
(textViewLiked.getTop() + textViewLiked.getHeight()));
PropertyValuesHolder pvhAlphaTextViewLiked = PropertyValuesHolder
.ofFloat(View.ALPHA, 1f, 0f);
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(textViewLiked,
pvhYTextViewLiked,
pvhAlphaTextViewLiked);
ObjectAnimator objectAnimatorFab = ObjectAnimator.ofFloat(fab, View.Y, fab.getY(),
fab.getY() + textViewLiked.getHeight());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(objectAnimator).with(objectAnimatorFab);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
textViewLiked.setVisibility(View.GONE);
}
});
animatorSet.start();
}
}, 1000);
}
});
您可以相应地调整持续时间
创建 new Handler
只是为了使进度指示器的过程自动完成。你可以打电话给完成进度指示器。
答案 2 :(得分:0)
毕竟解决方案是使用gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.E().valueMap()
==>[weight:0.5]
==>[weight:1.0]
==>[weight:0.4]
==>[weight:1.0]
==>[weight:0.4]
==>[weight:0.2]
gremlin> g.E().each{ edge -> println ElementHelper.propertyValueMap(edge) };[]
[weight:0.5]
[weight:1.0]
[weight:0.4]
[weight:1.0]
[weight:0.4]
[weight:0.2]
从gif可以看出,FAB在下降到原始位置时会被裁剪掉。因此,在FAB android:clipChildren="false"
的父级上使用android:clipChildren="false"
后,FAB不会再被裁剪。