小编Mat*_*s89的帖子

EXIT_ANIMATION_BUNDLE 不适用于 Chrome 自定义选项卡

我正在尝试将 Chrome 自定义选项卡合并到我的应用程序中,但我很难让退出动画正常工作。我正在关注此处找到的文档:
链接

我正在使用的代码如下所示:

String EXTRA_CUSTOM_TABS_EXIT_ANIMATION_BUNDLE = "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE";
Bundle finishBundle = ActivityOptions.makeCustomAnimation(mActivity, android.R.anim.slide_in_left, android.R.anim.slide_out_right).toBundle();
i.putExtra(EXTRA_CUSTOM_TABS_EXIT_ANIMATION_BUNDLE, finishBundle);

Bundle startBundle = ActivityOptions.makeCustomAnimation(mActivity, R.anim.slide_in_right, R.anim.slide_out_left).toBundle();
mActivity.startActivity(i, startBundle);
Run Code Online (Sandbox Code Playgroud)

该选项卡以所需的动画启动,但以默认的活动动画结束。有任何想法吗?

android chrome-custom-tabs

7
推荐指数
1
解决办法
1580
查看次数

android:FragmentTransactions中没有尊重提升

所以我的布局看起来类似于以下内容:

     <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_height="wrap_content"
            android:elevation="4dp"
            android:background="?attr/colorPrimary"
            android:layout_width="match_parent"
            android:minHeight="?attr/actionBarSize"/>

         <FrameLayout
             android:id="@+id/content"
             android:layout_below="@+id/toolbar"
             android:layout_width="match_parent"
             android:layout_height="match_parent"/>

    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

这为我的活动形成了我的基本布局文件,然后我将FrameLayout替换为各种片段.一个这样的片段有这样的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <SlidingTabLayout
        android:id="@+id/sliding_tabs"
        android:layout_width="match_parent"
        android:elevation="4dp"
        android:layout_height="wrap_content"/>

    <android.support.v4.view.ViewPager
        android:id="@+id/profileViewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/sliding_tabs"
        android:background="@android:color/white"/>

    <FloatingActionButton
        android:id="@+id/floatingButton"
        android:layout_width="72dp"
        android:layout_height="72dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="16dp"
        android:layout_marginBottom="16dp"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我希望,因为我已将工具栏和SlidingTabLayout的高程设置为4dp,工具栏不会在选项卡上投射阴影,但它会:

截图

理想情况下,我不想在代码中设置工具栏的高程 - 有没有人知道是否有办法防止工具栏投射阴影?我会假设两个视图都在4dp高度,即使它们不在同一个布局中,也不会投射阴影.

谢谢您的帮助.

android material android-fragments android-5.0-lollipop

5
推荐指数
1
解决办法
2076
查看次数