【问题标题】:android: ImageView fadingEdge not workandroid:ImageView fadingEdge 不起作用
【发布时间】:2014-02-11 08:03:41
【问题描述】:

我的应用中有一个 ImageView,图像视图的褪色效果在这里不起作用是我的 imageView

<ImageView
    android:id="@+id/prevImageview"
    android:layout_width="200dp"
    android:layout_height="100dp"
    android:layout_weight="0.61"
    android:fadingEdge="horizontal|vertical"
    android:requiresFadingEdge="horizontal|vertical"
    android:fadingEdgeLength="20dp"
    android:src="@drawable/landscape_" />

但我看不到任何褪色效果。 谁能告诉我解决方案是什么? 谢谢

【问题讨论】:

  • 你对图像视图应用什么类型的效果
  • 我想看看图片边框的淡化效果
  • 但是像什么淡入淡出效果,淡入淡出,反弹,旋转等等……
  • 试试下面的代码,让我知道它是否有效。

标签: android imageview fading


【解决方案1】:

好的,尝试使用下面的代码。

创建名为 fadein.xml

的 XML
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="1.0" />

</set>

然后将其添加到您的图像视图中

<ImageView
    android:id="@+id/prevImageview"
    android:layout_width="200dp"
    android:layout_height="100dp"
    style="@drawable/fadein"
    android:src="@drawable/landscape_" />

【讨论】:

  • 谢谢,但我还看不到任何褪色效果
  • 我认为这是因为你看不到效果的时间太短了,像android:duration="1000"android:duration="5000" 一样增加持续时间。并尝试
  • 我有一个问题:持续时间是什么意思?我只想要像这样的图像边框上的静态褪色效果:filterforge.com/filters/11330.jpg
  • 我尝试使用 android:duration="10000" 但这不起作用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多