Val*_*hev 8 android android-animation android-fragments material-design android-appbarlayout
我让我的TabLayout用动画的android:animateLayoutChanges ="真"的AppBarLayout.但是当我设置TabLayout.setVisibility(View.GONE)时,我的片段的容器立即上升到ActionBar几毫秒.然后它返回到TabLayout的末尾并将其上升到ActionBar.我在下面的gif上解释了这个.
由于某些原因,TabLayout背后的理论和实践按钮,但是当隐藏TabLayout动画时,启动FrameContainer,将我的视图固定在TabLayout的底部.
我录制了一段视频来说明这种行为.Dropbox视频播放器跳过一些帧和动画似乎很好.这就是为什么,要注意这个错误,你可以在电脑上加载视频,并以高质量观看5秒和11秒.视频
我的LayoutXML:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<SurfaceView
android:layout_width="0px"
android:layout_height="0px"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:visibility="gone"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/white"
app:tabMode="fixed"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!--
This FrameLayout holds my fragments.
-->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/outer_background">
<ProgressBar
android:id="@+id/main_load_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"/>
</FrameLayout>
<include
android:id="@+id/left_drawer_full"
layout="@layout/navigation_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"/>
</android.support.v4.widget.DrawerLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
另外我使用的是23.2.1支持库.
我怎样才能修复这个眨眼和跳跃?
尝试添加android:animateLayoutChanges="true"到您的视图
app:layout_behavior="@string/appbar_scrolling_view_behavior
Run Code Online (Sandbox Code Playgroud)
这就是你的DrawerLayout.然后LayoutTransition.CHANGING在其上启用Transition Type ,如下所示:
ViewGroup layout = (ViewGroup) findViewById(R.id. drawer_layout);
LayoutTransition layoutTransition = layout.getLayoutTransition();
layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
Run Code Online (Sandbox Code Playgroud)
相关:https://stackoverflow.com/a/22573099/1363742
| 归档时间: |
|
| 查看次数: |
1792 次 |
| 最近记录: |