瀑布流demo
public void setup() { containerLayout = new LinearLayout(getContext()); containerLayout.setBackgroundColor(Color.WHITE); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); addView(containerLayout, layoutParams); for (int i = 0; i < colCount; i++) { LinearLayout colLayout = new LinearLayout(getContext()); LinearLayout.LayoutParams colLayoutParams = new LinearLayout.LayoutParams( colWidth, LinearLayo ut.LayoutParams.WRAP_CONTENT); colLayout.setPadding(2, 2, 2, 2); colLayout.setOrientation(LinearLayout.VERTICAL); containerLayout.addView(colLayout, colLayoutParams); colLayoutArray.add(colLayout); } try { imageFilePaths = getContext().getAssets().list("images"); } catch (IOException e) { e.printStackTrace(); } addNextPageContent(true); } ut.LayoutParams.WRAP_CONTENT); colLayout.setPadding(2, 2, 2, 2); colLayout.setOrientation(LinearLayout.VERTICAL); containerLayout.addView(colLayout, colLayoutParams); colLayoutArray.add(colLayout); } try { imageFilePaths = getContext().getAssets().list("images"); } catch (IOException e) { e.printStackTrace(); } addNextPageContent(true); }
用户评论
不好改,不过能用