I need to set the top margin on a RecyclerView programmatically, but I get this exception:
java.lang.RuntimeException: Unable to resume activity java.lang.Cla
Try this out. You can refer to this for more info.
ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(mRecyclerView.getLayoutParams()); marginLayoutParams.setMargins(0, 10, 0, 10); mRecyclerView.setLayoutParams(marginLayoutParams);