android - RippleDrawable NOT drawing over Views -


i have layout kenburnsview , imageview on (just toggle button). when click on button ripple generated drawn below kenburnsview.

previously, when had image view in replacement kenburnsview ripple drawn above imageview on top.

here layout:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/drawer"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@color/background"     android:clickable="true"     android:orientation="vertical">       <relativelayout         android:id="@+id/header"         android:layout_width="match_parent"         android:layout_height="@dimen/nav_drawer_header_height">          <framelayout             android:layout_width="match_parent"             android:layout_height="match_parent">              <com.flaviofaria.kenburnsview.kenburnsview                 android:id="@+id/header_cover"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:src="@drawable/cover_1" />              <relativelayout                 android:layout_width="match_parent"                 android:layout_height="match_parent">                  <imageview                     android:id="@+id/header_toggle"                     android:layout_width="50dp"                     android:layout_height="30dp"                     android:layout_alignparentbottom="true"                     android:layout_alignparentright="true"                     android:layout_marginbottom="10dp"                     android:layout_marginright="10dp"                     android:padding="10dp"                     android:src="@drawable/toggle_down" />              </relativelayout>          </framelayout>      </relativelayout>      <relativelayout         android:id="@+id/nav_toggle_container"         android:layout_width="wrap_content"         android:layout_height="wrap_content"></relativelayout>  </linearlayout> 

this ripple drawable xml:

<ripple xmlns:android="http://schemas.android.com/apk/res/android"     android:color="@android:color/white"     android:drawselectorontop="true"> <!-- ripple color -->  </ripple> 

this how adding ripple:

toggle.setbackground(getresources().getdrawable(r.drawable.ripple)); 

what problem because of ripple gets drwan below kenburnsview? used work when there imageview in place of kenburnsview?

as can see own code ('setbackground') , you're setting ripple background that's why it's being drawn on background.

imageview on android api 21 added "hack" ripple android:drawselectorontop="true". library you're using didn't add same hack it.

there's nothing wrong on code. type of behavior cannot guaranteed android team 3rd party libraries.

you have few of options here vary on cleanliness, effort , performance:

  1. check imageview source code, clone library, add same hack imageview used on ripple. after it's working fine, make sure pull request library.
  2. wrap kenburnsview framelayout , set ripple using setforeground on framelayout.
  3. clone library, add option foreground drawable (similar how set foreground attribute other non framelayout view). make sure pull request valueable code library.

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -