How to Add Android View Hover Effect

Apr 13, 2017
188 Views
Image

Hover effect is now a cool effect for new Android application but you need to know where and how you’ll use it. And if you don’t know how to implement Android view hover effect in your application then this tutorial is for you.

In my opinion, jumping to a new activity to show your menu is a kind of wasting time and life. So, I think, we need a hover view, to show menu, to show messages.

Steps for How to add Android View Hover effect

Set up RenderScript in build.gradle defaultConfig

  1. renderscriptTargetApi 19
  2. renderscriptSupportMode true

Gradle

  1. dependencies {
  2. compile "com.android.support:support-v4:20.+"
  3. compile 'com.nineoldandroids:library:2.4.0'
  4. compile 'com.daimajia.easing:library:1.0.0@aar'
  5. compile 'com.daimajia.androidanimations:library:1.1.2@aar'
  6. compile 'com.daimajia.androidviewhover:library:1.0.4@aar'
  7. }

Maven

  1. <dependency>
  2. <groupId>com.nineoldandroids</groupId>
  3. <artifactId>library</artifactId>
  4. <version>2.4.0</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>com.daimajia.androidanimation</groupId>
  8. <artifactId>library</artifactId>
  9. <version>1.1.2</version>
  10. <type>apklib</type>
  11. </dependency>
  12. <dependency>
  13. <groupId>com.daimajia.easing</groupId>
  14. <artifactId>library</artifactId>
  15. <version>1.0.0</version>
  16. <type>apklib</type>
  17. </dependency>
  18. <dependency>
  19. <groupId>com.daimajia.androidviewhover</groupId>
  20. <artifactId>library</artifactId>
  21. <version>1.0.4</version>
  22. <type>apklib</type>
  23. </dependency>

Create an original view, and make sure it was wrapped by BlurLayout

Add Android View Hover Effect
Add Android View Hover Effect

For example:

  1. <com.daimajia.androidviewhover.BlurLayout
  2. android:id="@+id/sample"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content">
  5. <ImageView
  6. android:layout_centerInParent="true"
  7. android:scaleType="fitXY"
  8. android:src="@drawable/kid"
  9. android:layout_width="match_parent"/>
  10. </com.daimajia.androidviewhover.BlurLayout>

NoteBlurLayout is entended from RelativeLayout. You can use the RelativeLayoutrules to layout your view.

Source : http://www.tellmehow.co/add-android-view-hover-effect/

Comments
avatar
Please sign in to add comment.