看了一个开源项目 https://github.com/daimajia/AndroidViewHover
主要就是利用这个库做一些动画效果
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.Element;import android.support.v8.renderscript.RenderScript;
import android.support.v8.renderscript.ScriptIntrinsicBlur;
默认eclipse没办法直接找到这个renderscript这个类库,需要你到支持这个jar包的目录在\sdk\build-tools\里面
直接copy到你的project的libs目录下即可。
后记:
或许有的朋友会遇到以下错误
10-05 23:39:51.000: E/AndroidRuntime(4160): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.daimajia.androidviewhover.demo/com.daimajia.androidviewhover.demo.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
这个错误信息提示比较清楚了,需要在value目录里的style.xml写成以下:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat">
<!-- Customize your theme here. -->
</style>
</resources>