Posts

Showing posts from December, 2017

ButterKnife with Kotlin

Butter Knife With Kotlin (No Need) Butter Knife Butter knife is a little and light weight library used to inject android components using annotation processing If you android app using Kotlin then there is no need for butter knife or findviewbyid , we can simple use view id as view object as in example below   Textview layout < TextView android:id="@+id/textview" android:layout_width="match_parent" android:layout_height="55dp" android:gravity="center" android:text="Hello World!" android:textAlignment="center" android:textAllCaps="true" android:textColor="@color/colorPrimary"/> In the above textview we set textview as id for the textview view we can change color , settext etc,.   //you can use this on any methods in lifecycle no need to instantiate the view textview.setTextColor(Color. RED ) textview. text = "this text setted programati...

GESTURE DETECTOR ON VIEWS | IMAGEVIEW | TEXTVIEW | BUTTON | RELATIVELAYOUT

Gesture Detector         Gesture detector is used to find detect gestures like single tap,double tap, single tap confirmed, onfling , scrolling etc,.   activity_layout.xml < Button   android :textColor= "@android:color/white"     android :backgroundTint= "@android:color/holo_blue_dark"     android :text= "touch me "   android :layout_centerInParent= "true"     android :id= "@+id/button"   android :layout_width= "match_parent"   android :layout_height= "110dp" />   Declare gesture detector object   lateinit var mygestureDetector : GestureDetector   Define gesture detector object in oncreate mygestureDetector = GestureDetector ( this @MainActivity , MyGestureDetector())     Define touch listener object  var touchListener = View.OnTouchListener{ v,event-> mygestureD...