我想在ConstraintLayout
之外定位视图以使用滑动动画为其设置动画效果。我已经尝试设置像constraintBottom_toTopOf="parent"
这样的限制,但View
停留在容器内。ConstraintLayout之外的位置视图
请注意,我想通过约束来实现这一点,以使用内置动画,而不是使用代码内动画。
任何想法我可以做到这一点?
我使用compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
与Android Studio的3.0测试版7
这是应该把视图的容器外的简单的XML文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/colorAccent">
<View
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
我从来没有尝试过,但约varing从0到1的偏见是什么? – Juan
请分享您的xml –
发布您正在使用哪个版本的'ConstraintLayout'。确保你没有定义额外的约束,将视图拉回布局。另外,查看XML会很有帮助。 – Cheticamp