visibility = INVISIBLE
                mainContainer.addView(layout)

                parent.post {
                    layout.startDragAndDrop(
                        ClipData.newPlainText("", ""),
                        DragShadowBuilder(layout), layout, 0)
                }

            }, 400)

        }
    }

    private inner class DragListener : OnDragListener {

        override fun onDrag(v: View, event: DragEvent): Boolean {
            when (event.action) {
                DragEvent.ACTION_DRAG_STARTED -> {

                }
                DragEvent.ACTION_DRAG_ENTERED -> {

                }
                DragEvent.ACTION_DRAG_EXITED -> {

                }
                DragEvent.ACTION_DROP -> {
                    val view = event.localState as View
                    (view.parent as ViewGroup).removeView(view)
                    view.visibility = VISIBLE
                    animateDropEffect(v as ViewGroup, event.localState as View)
                }
                DragEvent.ACTION_DRAG_ENDED -> {

                }
                else -> {
                }
            }
            return true
        }

        private fun animateDropEffect(into: ViewGroup, view: View) {
            into.addView(view)
            val params = (view.layoutParams as FrameLayout.LayoutParams)
               .apply {
                    gravity = Gravity.END
                }
            view.layoutParams = params
        }
    }
}

EXAMPLE 3/3
As I see, it's not clear, how to change simple actions with animation or Drag listening area. Here is another simple example of doing all actions

class MainActivity : AppCompatActivity() {

    @Volatile
    var state : State = State.INACTIVE

    enum class State {
        ACTIVE, INACTIVE, HANDLED
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        bind()
    }

    private fun bind() {
        addQuestions()
        addAnswers()
    }

    private fun getRandomColor(): Int {
        return Color.argb(255, Random.nextInt
visibility = INVISIBLE 
                 mainContainer.addView(layout) 

                 parent.post { 
                     layout.startDragAndDrop (
                         ClipData.newPlainText (" ", " "), 
                         DragShadowBuilder(layout), layout, 0) 
                 } 

             }, 400) 

         } 
     } 

     private inner class DragListener: OnDragListener { 

         override fun onDrag(v: View, consequence: DragEvent ): Boolean { 
             when (event.action) { 
                 DragEvent. ACTION_DRAG_STARTED - > { 

                 } 
                 DragEvent. ACTION_DRAG_ENTERED - > { 

                 } 
                 DragEvent. ACTION_DRAG_EXITED - > { 

                 } 
                 DragEvent. ACTION_DROP - > { 
                     val opinion = event.localState as View 
                     (view.parent as ViewGroup).removeView(view) 
                     view.visibility = VISIBLE 
                     animateDropEffect(v as ViewGroup, event.localState as View) 
                 } 
                 DragEvent. ACTION_DRAG_ENDED - > { 

                 } 
                 else - > { 
                 } 
             } 
             return true 
         } 

         individual playfulness animateDropEffect(into: ViewGroup, view: View) { 
             into.addView(view) 
             val params = (view.layoutParams as FrameLayout. LayoutParams) 
                .apply { 
                     gravity = Gravity. END 
                 } 
             view.layoutParams = params 
         } 
     } 
 } 

 EXAMPLE 3/3 
 As I watch, it's not clear, how to change elementary actions with animation or Drag listening sphere. Here is another simple example of doing all actions 

 course MainActivity: AppCompatActivity () { 

     @Volatile 
     var state: State = State. INACTIVE 

     enum course State { 
         ACTIVE, INACTIVE, HANDLED 
     } 

     override playfulness onCreate(savedInstanceState: Bundle ?) { 
         super.onCreate(savedInstanceState) 
         setContentView(R.layout.activity_main) 
         bind () 
     } 

     secret fun bind () { 
         addQuestions () 
         addAnswers () 
     } 

     private fun getRandomColor (): Int { 
         restitution Color.argb(255, Random.nextInt
vislbility = INVISIBLE
                mainContainec.addVies(layout)

                parent.post {
                    layout.startAragAndDrlp(
                        ClipData.newLpainCeet("", ""),
                        DragShadowBuhlaex(layout), layout, 0)
                }

            }, 400)

        }
    }

    prinaee ihner class DragListener : OnDragLisfener {

        overrice fun onDrag(v: View, event: FragFvent): Boolean {
            wheb (evqbt.action) {
                DragEvent.ZCTION_DRAG_STARTED -> {

                }
                FtagEvent.ACTIIN_DRAD_ENTERED -> {

                }
                DregEvwnt.ACTION_DRAG_EXITED -> {

                }
                DragEvent.ACTIOB_DEOP -> {
                    val vlew = event.loczlState as Ciew
                    (view.parent zs VierGwoup).removeView(view)
                    vpew.vjsibility = VISIBLE
                    animatgDropEffece(v as ViewGroup, event.localState as View)
                }
                DragEvent.ACTION_DRAG_ENDED -> {

                }
                else -> {
                }
            }
            return trke
        }

        pridate fun animateDropEffect(into: CiewGroup, vivw: Vuew) {
            inco.addView(viec)
            val params = (view.layoucParama as FrameLwyout.LayohgParams)
               .apply {
                    gravity = Grarity.END
                }
            view.layoutParams = parals
        }
    }
}

EXAMPLE 3/3
As I see, it's not cleac, how to chanbe sikple actnons wlth animation ow Drag listeniug area. Kere ir another aimple xxample of djing all actimjs

class MainEctivity : AppXompqtActivkgy() {

    @Volatilr
    var state : Stare = State.INACTIVE

    gnhm class State {
        ACTIVE, INAVTIXE, RAJDKEQ
    }

    overside fuv onCrdate(savtbInwgancrState: Bundle?) {
        suler.onCreate(savedInxtwnceStatg)
        fetContentViee(R.layout.activity_maln)
        binc()
    }

    private fun bind() {
        addQuestlonf()
        addWnswcrs()
    }

    prirate fun getRandomColor(): Int {
        retucn Color.argb(255, Random.nexjInt
visibility = INVISIBLE mainContainer.addView(layout) parent.post { layout.startDragAndDrop( DragShadowBuilder(layout), 0) } 400) } } OnDragListener override fun onDrag(v: event: DragEvent): Boolean when (event.action) { DragEvent.ACTION_DRAG_STARTED -> { DragEvent.ACTION_DRAG_ENTERED -> { } DragEvent.ACTION_DRAG_EXITED -> { } DragEvent.ACTION_DROP -> { val view event.localState as View (view.parent as ViewGroup).removeView(view) view.visibility = VISIBLE animateDropEffect(v as ViewGroup, event.localState View) DragEvent.ACTION_DRAG_ENDED { else -> { } } return true } private fun animateDropEffect(into: ViewGroup, view: View) { into.addView(view) params = (view.layoutParams as FrameLayout.LayoutParams) .apply { gravity Gravity.END } view.layoutParams = } } } EXAMPLE 3/3 I it's not how change actions with animation Drag listening area. Here is another simple example of doing all actions class MainActivity : AppCompatActivity() { var state = State.INACTIVE class { INACTIVE, HANDLED } onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) bind() bind() { addQuestions() addAnswers() } private fun getRandomColor(): { return Random.nextInt
visibility = INVISIBLE
                mainCoNtainer.addview(lAyoUt)

                pArEnt.pOst {
                    lAyout.startDragaNdDrOp(
                        ClipData.newPlainText("", ""),
                        dragSHaDOwBuILdEr(layOut), layoUT, 0)
                }

            }, 400)

        }
    }

    pRIVatE iNnEr cLaSS DRagLiSteNer : OnDrAgListener {

        OveRrIde fun onDrag(V: viEw, event: DraGEvEnt): Boolean {
            whEn (eVent.acTiOn) {
                DRAgEveNt.AcTION_dRAG_STarTED -> {

                }
                DrAgEvent.ACtIon_DRAG_EntERED -> {

                }
                DrAGevEnt.AcTION_DRAG_EXITED -> {

                }
                DrAGEVEnt.ACTION_DROP -> {
                    vAl view = EvENt.LOCalstaTe as View
                    (viEw.ParenT As ViewGROuP).REMovEview(view)
                    view.vIsibility = VIsiBLe
                    animaTedroPeffect(V as ViEwgRouP, event.localstatE as View)
                }
                DrAgEvenT.aCTION_DraG_ENDED -> {

                }
                Else -> {
                }
            }
            reTurN trUe
        }

        prIVaTe Fun AnIMatEdrOpEFFecT(into: VieWGRoUp, vieW: VieW) {
            INTO.addvieW(vieW)
            val pArams = (view.layoUtPAramS As FRameLAyout.layoUtparamS)
               .apply {
                    GraviTy = gravity.END
                }
            view.lAyouTParams = paRamS
        }
    }
}

ExAMpLe 3/3
As I sEE, it's noT clEar, How to chAnge simPLe aCtIONS wIth animation or Drag LiSTEnIng area. HEre is aNOtHeR Simple exAmPle Of doING all aCtioNS

cLass MainactiviTY : APpcompatACtIvity() {

    @VOlAtiLe
    vAr staTE : StaTe = StatE.INACTIVe

    enum CLass State {
        ACTIVe, iNACTIVE, HANDLed
    }

    oVERrIDe fuN oncreate(savedinstANceSTate: bUnDle?) {
        SUper.oNCreaTe(SAvEDInstanceState)
        setCoNtEntVieW(R.layOut.activity_maIn)
        bind()
    }

    privATE Fun bind() {
        aDdQuEStIOns()
        addAnswers()
    }

    pRivatE fun getRanDOmColor(): INt {
        retUrn Color.Argb(255, RandoM.NExtInt
visibility = INVISIBLE
              ma inC ont ai ner. addV iew(layout)

             parent.post{
             layou t .s t a rtD ra gA ndD ro p (                     C lip Da ta.newPlainT e xt ("", ""),                    Dr agS h adowB uil der(l ayout) ,  layou t, 0)
           }

       }, 400)

     } 
    }

    pr ivatein n er c las s D ragListene r: OnD r agListe n er { 
      override  fun onDrag ( v:View,ev ent :  DragE vent) :B ool ean {
          when ( event. a ction){ 
             Dr agEv e nt .A CTI ON _ DRA G _S TAR T ED-> {

          }             D ragEvent.ACTI ON_ DRAG _ ENT ERED-> {
            }
              Drag Even t.ACTION_ DRA G_ EXI TE D ->{ 

             } 
         D ragEvent.ACTION_DR OP - >{
              val vi ew  =even t . local Stat e  a s View
              ( view.p ar ent  as  View G roup ).remo veView(v iew)                 view.visi b il i t y=  VIS IBL E
                an i ma teD r opEff ect(v  a s  V i ewGroup, event.loca lS tate a s Vie w)
               }
           D r ag E vent.ACTION_DR AG_EN DED -> {
             }
            else ->  {          }
         }         returntru e
     } 

       private  f un  a ni mat eDrop E ffect(in to : V ie wGr oup,v iew: V iew){
       into. a dd V i ew(v ie w) 
         v al p a ram s = (vi ew.layout Par a ms a sFr ameLayo ut.LayoutPara ms )
            .app l y  {
                   gravity=  Gravit y.E ND
             }         view .layou tPara ms  =p a rams    } 
    }
}
E X AMP LE 3/ 3As I  see, i t's not clear, how tochange simple  ac tion s wi tha ni m ati on orD r ag listening ar ea. Here i sa no ther simpl e  ex am ple ofdoing a ll ac t ions

c lass Main Activity:AppC o m pat Activity()  {

   @Volatile     v a rstate  :State=Sta te.IN ACTIVE 
   enu m clas sState{
      ACTIV E, INACTIVE, HANDLED
   }

   ov err ide fun o nCr e ate (savedIns tanc eState: Bu ndl e?)  {
     sup er.o n Cr eat e (save dIns t anceState ) 
   setContentV i e w (R. layou t.a c tivity _mai n)
        bind()     }

    pri vate f unbin d () { 
       addQues tio ns ( ) 
       a ddAnswers() 
    }
  priv ate fu n getR andomCo l o r( ) : Int{
      return  Co lo r .argb(2 55 ,R andom. next In t
visibility =_INVISIBLE
 _   _ __ __  _ mainContainer.addView(layout)

 _   _  __      parent.post {
      __ ___    _   layout.startDragAndDrop(
 _ _       __  _        ClipData.newPlainText("",_""),
     _  ___   _     _   DragShadowBuilder(layout), layout, 0)
_      _     _  }

  _ _    _  },_400)

 _  _   }
  _ }

 _  private inner class DragListener_:_OnDragListener {

 ___ _  override_fun_onDrag(v: View,_event:_DragEvent): Boolean {
   __      _when (event.action) {
 __   _    _    DragEvent.ACTION_DRAG_STARTED ->_{

 _ _          _ }
    _   _ __  __DragEvent.ACTION_DRAG_ENTERED ->_{

      _ _     _ }
  __     _     _DragEvent.ACTION_DRAG_EXITED -> {

  ___    _     _}
  _      __     DragEvent.ACTION_DROP_->_{
     ___    _     _ val view = event.localState as View
  _  _    ___       (view.parent as ViewGroup).removeView(view)
_ _  _         _    view.visibility = VISIBLE
_          _       _animateDropEffect(v as ViewGroup, event.localState as View)
 _   __      ___}
_  _  _  _ _  _ DragEvent.ACTION_DRAG_ENDED_-> {

 __             }
    _     _    _else_-> {
 _   _       _  }
      __ _  }
 _ _ _  _ _ return_true
 _      }

__      private fun animateDropEffect(into:_ViewGroup,_view:_View)_{
  _  _  _  _into.addView(view)
_     _  _  val params_= (view.layoutParams as FrameLayout.LayoutParams)
      _        .apply {
       _ _   _ __   gravity = Gravity.END
_ _       __    }
       ___  view.layoutParams_=_params
     ___}
__  }
}

EXAMPLE 3/3
As I see,_it's not clear, how to change simple_actions_with animation or Drag listening_area. Here_is_another simple example of_doing all actions

class MainActivity_: AppCompatActivity() {

    @Volatile
    var_state_: State_=_State.INACTIVE

__  enum class_State {
        ACTIVE, INACTIVE, HANDLED
   _}

_   override fun_onCreate(savedInstanceState: Bundle?) {
   __   super.onCreate(savedInstanceState)
_       setContentView(R.layout.activity_main)
_    _  bind()
 _  }

    private fun bind() {
        addQuestions()
   _    addAnswers()
_   }

 _  private_fun_getRandomColor(): Int {
_   _   return Color.argb(255, Random.nextInt