xml - Android Studio CheckBox Animation -


i trying add settings page custom checkboxes. checkboxes extend entire width of screen, default click animation of these checkboxes makes extremely awkward: click animation

i have tried enclose checkbox in linear layout not restrict animation. need create custom animation checkbox? if so, how restrict click animation container of checkbox? posted below portion of code.

                  <textview                         android:id="@+id/emailfield"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_marginbottom="10dp"                         android:layout_margintop="10dp"                         android:text="@string/pref_header_push_notifications"                         android:textcolor="@color/settingstext"                         android:textsize="20sp"/>                     <view                         android:layout_width="fill_parent"                         android:layout_height="1dp"                         android:layout_marginbottom="15dp"                         android:layout_margintop="15dp"                         android:background="@color/lightgray" />                     <linearlayout                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:orientation="horizontal"                         android:weightsum="9">                          <checkbox                             android:id="@+id/receipts"                             android:layout_width="match_parent"                             android:layout_height="wrap_content"                             android:layout_alignparentend="true"                             android:layout_alignparentleft="true"                             android:layout_alignparentright="true"                             android:layout_alignparentstart="true"                             android:layout_alignparenttop="true"                             android:button="@null"                             android:drawableright="?android:attr/listchoiceindicatormultiple"                             android:text="@string/pref_title_receipts" />                     </linearlayout>                       <checkbox                         android:id="@+id/offers"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_alignparentend="true"                         android:layout_alignparentleft="true"                         android:layout_alignparentright="true"                         android:layout_alignparentstart="true"                         android:layout_alignparenttop="true"                         android:button="@null"                         android:drawableright="?android:attr/listchoiceindicatormultiple"                         android:text="@string/pref_title_offers"                         android:checked="false"                         android:layout_margintop="20dp"                         android:layout_marginbottom="20dp" />                       <checkbox                         android:id="@+id/messages"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_alignparentend="true"                         android:layout_alignparentleft="true"                         android:layout_alignparentright="true"                         android:layout_alignparentstart="true"                         android:layout_alignparenttop="true"                         android:button="@null"                         android:drawableright="?android:attr/listchoiceindicatormultiple"                         android:text="@string/pref_title_messages" />                     <view                         android:id="@id/separator"                         android:layout_width="fill_parent"                         android:layout_height="1dp"                         android:layout_marginbottom="10dp"                         android:layout_margintop="15dp"                         android:background="@color/lightgray" /> 

thank much.

edit

this ripple drawable file

<ripple xmlns:android="http://schemas.android.com/apk/res/android"     android:exitfadeduration="@android:integer/config_shortanimtime"     android:color="@color/lightgray" >      <item android:id="@android:id/mask">         <shape android:shape="rectangle" >             <solid android:color="@android:color/holo_green_light" />         </shape>     </item> </ripple> 

and have applied attribute in android:src="@drawable/checkbox_ripple_effect"

still not working, doing wrong here?

update: wondering, ended creating layerlist instead of using ripple drawable.

checkbox_ripple_element.xml:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">     <item>         <shape xmlns:android="http://schemas.android.com/apk/res/android"             android:shape="rectangle">             <solid android:color="@android:color/white" />             <corners android:radius="6dp" />         </shape>     </item>     <item android:drawable="?android:selectableitembackground" /> </layer-list> 

and in activity_main.xml:

.... android:background="@drawable/checkbox_ripple_effect" .... 

Comments

Popular posts from this blog

python - pip install -U PySide error -

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -