@Override protected View newView(int viewType) { switch (viewType) { case ITEM_TYPE_TWO: View view_double = LayoutInflater.from(getContext()).inflate(R.layout.listview_item_dish, null); View itemLeft = view_double.findViewById(R.id.app_list_item_left); View itemRight = view_double.findViewById(R.id.app_list_item_right); setViewStatues(itemLeft); setViewStatues(itemRight); int itemViewWidth = (ScreenUtils.getScreenWidthInt() - 3 * ScreenUtils.dip2px(8)) / 2; ScreenUtils.resizeView( itemLeft.findViewById(R.id.app_dish_cover_group), itemViewWidth, 1f); ScreenUtils.resizeViewOfWidth( itemLeft.findViewById(R.id.app_dish_title_group), itemViewWidth); ScreenUtils.resizeView( itemRight.findViewById(R.id.app_dish_cover_group), itemViewWidth, 1f); ScreenUtils.resizeViewOfWidth( itemRight.findViewById(R.id.app_dish_title_group), itemViewWidth); ScreenUtils.reMargin( itemLeft.findViewById(R.id.app_dish_restaurant_group), 0, 0, 0, 75, true); ScreenUtils.reMargin( itemRight.findViewById(R.id.app_dish_restaurant_group), 0, 0, 0, 75, true); View coverL = itemLeft.findViewById(R.id.app_dish_content); ScreenUtils.resizeView(coverL, itemViewWidth, 251.5f / 172.5f); View coverR = itemRight.findViewById(R.id.app_dish_content); ScreenUtils.resizeView(coverR, itemViewWidth, 251.5f / 172.5f); return view_double; case ITEM_TYPE_ONE: default: View view_single = LayoutInflater.from(getContext()).inflate(R.layout.view_dish_big, null); setViewStatues(view_single); int itemViewWidthBig = ScreenUtils.getScreenWidthInt() - 2 * ScreenUtils.dip2px(8); View content = view_single.findViewById(R.id.app_dish_content); ScreenUtils.resizeView(content, itemViewWidthBig, 257 / 355f); return view_single; } }