List of usage examples for android.widget ScrollView getChildCount
public int getChildCount()
From source file:Main.java
public static Bitmap createBitmap(Context context, ScrollView v) { int width = 0, height = 0; for (int i = 0; i < v.getChildCount(); i++) { width += v.getChildAt(i).getWidth(); height += v.getChildAt(i).getHeight(); }/*w ww. j ava 2 s . c om*/ if (width <= 0 || height <= 0) { return null; } int h = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight(); if (height < h) height = h; Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); v.draw(canvas); return bitmap; }
From source file:com.bobomee.android.common.util.ScreenUtil.java
/** * http://blog.csdn.net/lyy1104/article/details/40048329 *///from w w w . j a v a2s.co m public static Bitmap shotScrollView(ScrollView scrollView) { int h = 0; Bitmap bitmap = null; for (int i = 0; i < scrollView.getChildCount(); i++) { h += scrollView.getChildAt(i).getHeight(); scrollView.getChildAt(i).setBackgroundColor(Color.parseColor("#ffffff")); } bitmap = Bitmap.createBitmap(scrollView.getWidth(), h, Bitmap.Config.RGB_565); final Canvas canvas = new Canvas(bitmap); scrollView.draw(canvas); return bitmap; }
From source file:com.google.reviewit.ReviewChangesFragment.java
private void init() { SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) v(R.id.swipeRefreshLayout); swipeRefreshLayout.setColorSchemeColors(widgetUtil.color(R.color.progressBar)); swipeRefreshLayout.setRefreshing(true); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override/*from w w w . j a v a2 s . c o m*/ public void onRefresh() { getApp().getQueryHandler().reset(); loadAndDisplay(true); } }); v(R.id.reloadButton).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { reloadQuery(); } }); final View nextPageProgress = v(R.id.nextPageProgress); final ScrollView scrollView = (ScrollView) v(R.id.scrollView); scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { if (isAdded() && getApp().getQueryHandler().hasNext() && nextPageProgress.getVisibility() == View.GONE) { View lastChild = scrollView.getChildAt(scrollView.getChildCount() - 1); if ((lastChild.getBottom() - (scrollView.getHeight() + scrollView.getScrollY())) == 0) { setVisible(nextPageProgress); scrollView.post(new Runnable() { @Override public void run() { scrollView.fullScroll(View.FOCUS_DOWN); loadAndDisplay(); } }); } } } }); }