I have an edittext and its width is set to wrap-content.I also have an recycler view and its width is set to wrap-content. i want to make recycler view width to be equals to edit text width programmatically.I used below code but its not working.width returns from getMeasuredWidth() is not equal to edittext width.
editText= findViewById(R.id.edit_text);
editText.measure(0, 0);
testRecyclerView= findViewById(R.id.employee_recycler_view);
testRecyclerView.setLayoutManager(new LinearLayoutManager(context));
ViewGroup.LayoutParams layoutParams = testRecyclerView.getLayoutParams();
layoutParams.width = editText.getMeasuredWidth();
testRecyclerView.setLayoutParams(layoutParams);