Posts

ProgressDialog with transparent background XamarinAndroid

Image
Code Snippet : progress_dialog.xaml <? xml   version = " 1 . 0 "   encoding = " utf - 8 " ?> < LinearLayout   xmlns:android = " http : / / schemas . android . com / apk / res / android "         xmlns:app = " http : / / schemas . android . com / apk / res - auto "         android:background = " @android : color / transparent "         android:gravity = " center "         android:layout_height = " match_parent "         android:layout_width = " match_parent "         android:orientation = " horizontal " >      < ProgressBar                 android:background = " @android : color / transparent "                 android:id = " @ + id / progressBar1 "                 android:layout_gra...

Disable swipe gesture on Switch button - Xamarin/Android

Issue : The problem with switch button in ListView is that when you click on the switch button its  SetOnCheckedChangeListener  wont get triggered  and when you swipe the button its  SetOnClickListener  wouldn't get trigger. Following is the code snippet to disable the swipe gesture for Switch button : Solution : Xamarin Android : 1. Implement  View . IOnTouchListener 2. viewHolder.SwitchButton.SetOnTouchListener(viewHolder); //To disable swipe on switch button          public   bool  OnTouch( View  v,  MotionEvent  e)         {              return  e.ActionMasked ==  MotionEventActions .Move;         } Android : switchButton.setOnTouchListener( n...