Hi Guys, Maybe you all are expert in terms of using RecyclerView in android. This blog is simple example for using filter option with RecyclerView adapter. As for now you will instantiate RecyclerView and set the adapter to RecyclerView as following way. RecyclerView list = (RecyclerView) findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(this)); list.setHasFixedSize(true); ArrayList<Number> numbers = new ArrayList<>(); String ONEs[] = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN"}; String TENs[] = {"ZERO", "TEN", "TWENTY", "THIRTY", "FOURTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY", "HUNDRED"}; String HUNDREDS[] = {"ZERO", "HUNDRED", "TWO HUND...
Hello All, By using simple onTouch event we make an DraggableTextView widget. Here is the code sample for you. override fun onTouch(v: View?, event: MotionEvent?): Boolean { val x = event?.rawX?.toInt()!! val y = event.rawY.toInt() when (event.action) { MotionEvent.ACTION_DOWN -> { val layoutParams = layoutParams as ConstraintLayout.LayoutParams xDelta = x - layoutParams.leftMargin yDelta = y - layoutParams.topMargin rect.set(0, 0, width, height) isDragging = true } MotionEvent.ACTION_MOVE -> { val layoutParams = layoutParams as ConstraintLayout.LayoutParams layoutParams.leftMargin = x - xDelta layoutParams.topMargin = y - yDelta setLayoutParams(layoutParams) } MotionEvent.ACTION_UP -> { isDragging = false } } invalidate() return true } Here is the full video tutorial. Interesting...