【发布时间】:2018-07-04 22:02:39
【问题描述】:
在我的CountryImageInfo.java 中,我有一个折叠工具栏,里面有一张图片。
这是它的样子:
我想知道如何在图像塌陷时对其进行模糊处理,以及如何在图像再次倒塌时对其进行去模糊处理。类似于iOS的通知栏,不知道大家有没有熟悉... 我见过类似的问题,但不同的是,有些人问如何模糊它被折叠了(不是我要问的。我是在它折叠时问的。逐渐模糊)......
这是我的 XML,顺便说一下,所有内容都包含在 CoordinatorLayout 中:
<android.support.design.widget.AppBarLayout
android:id="@+id/testeparainfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/actionBarDivider">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/backgroundcollapsedtoolbarinfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="exitUntilCollapsed|scroll">
<ImageView
android:id="@+id/imgCountryInfoFoto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/imgCountryInfoEscuro"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:background="@drawable/background_pais_info"
android:scaleType="centerInside" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbaridinfo"
android:layout_width="match_parent"
android:layout_height="200dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<TextView
android:id="@+id/txtNomePaisInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="30dp"
android:layout_marginTop="520dp"
android:paddingBottom="10dp"
android:text="TextView"
android:textColor="@android:color/background_light"
android:textSize="35sp"
app:layout_anchor="@+id/testeparainfo"
app:layout_anchorGravity="left|bottom" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
更新:
复制图像并不是我真正想要的,因为这些图像有点大,所以除了复制图像之外还有其他方法吗? 我搜索了一些库,但找不到任何可以满足我需求的东西...我可以将所有图像都变蓝,有没有办法设置侦听器以在用户向上拖动折叠条时开始模糊?请帮忙,我已经尝试了很多东西!
【问题讨论】:
-
查看answer。它可能会帮助你
-
@BrijeshJoshi 其实不是因为问这个问题的人想要的只是图像折叠时的模糊,而不是逐渐的啊
-
是的,但是如果您查看接受的答案,您会发现该人已在应用栏上添加了 OnOffsetChangedListener,该应用栏提供了根据他设置的偏移量已更改的详细信息blurView 的 alpha。所以最终这会对你有所帮助。
-
如果您仍有问题,请告诉我们
-
我试图按照答案所说的去做,但是当我尝试运行我的应用程序时它给了我这个错误:
More than one file was found with OS independent path 'lib/arm64-v8a/libRSSupport.so'
标签: java android xml android-collapsingtoolbarlayout android-blur-effect