三个RecyclerView宽度等分的时候,使用LinearLayout,width = 0,weight = 1会出现选中的时候本该是“黑龙江省”的文字变成“黑...”这样的情况,后来测试发现三个RecyclerView必须宽度为固定值是正常所以修改代码为:
int[] screenWH = UiUtils.getScreenWH(view.getContext()); for (int i = 0; i < view.getChildCount(); i++) { ViewGroup.LayoutParams layoutParams = view.getChildAt(i).getLayoutParams(); layoutParams.width = screenWH[0] / 3; view.getChildAt(i).setLayoutParams(layoutParams); }循环父view给三个RecyclerView分别动态设置宽度为屏幕的1/3