本文整理了Java中android.widget.ScrollView.getChildAt()
方法的一些代码示例,展示了ScrollView.getChildAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.getChildAt()
方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:getChildAt
暂无
代码示例来源:origin: GitLqr/LQRWeChat
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
代码示例来源:origin: florent37/MaterialViewPager
static boolean canScroll(View view) {
if (view instanceof ScrollView) {
ScrollView scrollView = (ScrollView) view;
View child = scrollView.getChildAt(0);
if (child != null) {
int childHeight = child.getHeight();
return scrollView.getHeight() < childHeight + scrollView.getPaddingTop() + scrollView.getPaddingBottom();
}
return false;
} else if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
int yOffset = recyclerView.computeVerticalScrollOffset();
return yOffset != 0;
}
return true;
}
代码示例来源:origin: jaydenxiao2016/AndroidFire
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
代码示例来源:origin: Aspsine/SwipeToLoadLayout
@Override
public void onScrollChanged() {
if (scrollView.getChildAt(0).getHeight() < scrollView.getScrollY() + scrollView.getHeight() && !ViewCompat.canScrollVertically(scrollView, 1)) {
swipeToLoadLayout.setLoadingMore(true);
}
}
};
代码示例来源:origin: umano/AndroidSlidingUpPanel
} else {
ScrollView sv = ((ScrollView) scrollableView);
View child = sv.getChildAt(0);
return (child.getBottom() - (sv.getHeight() + sv.getScrollY()));
代码示例来源:origin: gzu-liyujiang/AndroidPicker
height += scrollView.getChildAt(i).getHeight();
代码示例来源:origin: aa112901/remusic
ScrollView scrollView = (ScrollView) mTarget;
View view = (View) scrollView
.getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView
代码示例来源:origin: stackoverflow.com
...
ScrollView z = (ScrollView) findViewById(R.id.scroll);
int totalHeight = z.getChildAt(0).getHeight();
int totalWidth = z.getChildAt(0).getWidth();
u.layout(0, 0, totalWidth, totalHeight);
...
代码示例来源:origin: stackoverflow.com
View u = findViewById(R.id.scroll);
u.setDrawingCacheEnabled(true);
ScrollView z = (ScrollView) findViewById(R.id.scroll);
int totalHeight = z.getChildAt(0).getHeight();
int totalWidth = z.getChildAt(0).getWidth();
u.layout(0, 0, totalWidth, totalHeight);
u.buildDrawingCache(true);
Bitmap b = Bitmap.createBitmap(u.getDrawingCache());
u.setDrawingCacheEnabled(false);
//Save bitmap
String extr = Environment.getExternalStorageDirectory().toString() + File.separator + "Folder";
String fileName = new SimpleDateFormat("yyyyMMddhhmm'_report.jpg'").format(new Date());
File myPath = new File(extr, fileName);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(myPath);
b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
MediaStore.Images.Media.insertImage(getContentResolver(), b, "Screen", "screen");
}catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
代码示例来源:origin: tianshaojie/AndroidFine
@Override
protected boolean isReadyForPullEnd() {
View scrollViewChild = mRefreshableView.getChildAt(0);
if (null != scrollViewChild) {
return mRefreshableView.getScrollY() >= (scrollViewChild.getHeight() - getHeight());
}
return false;
}
代码示例来源:origin: stackoverflow.com
ScrollView scrollView = (ScrollView)findViewById(R.id...);
ViewTreeObserver observer = scrollView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int viewHeight = scrollView.getMeasuredHeight();
int contentHeight = scrollView.getChildAt(0).getHeight();
if(viewHeight - contentHeight < 0) {
// scrollable
}
}
});
代码示例来源:origin: chaychan/TouTiao
public static boolean isScrollViewToBottom(ScrollView scrollView) {
if (scrollView != null) {
int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
if (scrollContentHeight == realContentHeight) {
return true;
}
}
return false;
}
代码示例来源:origin: nuptboyzhb/SuperSwipeRefreshLayout
ScrollView scrollView = (ScrollView) mTarget;
View view = (View) scrollView
.getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView
代码示例来源:origin: stackoverflow.com
ScrollView iv = (ScrollView) findViewById(R.id.scrollView);
Bitmap bitmap = Bitmap.createBitmap(
iv.getChildAt(0).getWidth(),
iv.getChildAt(0).getHeight(),
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bitmap);
iv.getChildAt(0).draw(c);
// Do whatever you want with your bitmap
saveBitmap(bitmap);
代码示例来源:origin: huxq17/XRefreshView
public boolean canChildPullUp() {
if (child instanceof AbsListView) {
AbsListView absListView = (AbsListView) child;
return canScrollVertically(child, 1)
|| absListView.getLastVisiblePosition() != mTotalItemCount - 1;
} else if (child instanceof WebView) {
WebView webview = (WebView) child;
if (webview instanceof XWebView) {
return !((XWebView) webview).isBottom();
} else {
float left = webview.getContentHeight() * webview.getScale();
int right = webview.getHeight() + webview.getScrollY();
return left != right;
}
} else if (child instanceof ScrollView) {
ScrollView scrollView = (ScrollView) child;
View childView = scrollView.getChildAt(0);
if (childView != null) {
return canScrollVertically(child, 1)
|| scrollView.getScrollY() < childView.getHeight() - scrollView.getHeight();
}
} else {
return canScrollVertically(child, 1);
}
return true;
}
代码示例来源:origin: Jhuster/JNote
public static Bitmap createBitmap(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();
}
Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
v.draw(canvas);
return bitmap;
}
代码示例来源:origin: myxh/CoolShopping
@Override
protected boolean isReadyForPullEnd() {
View scrollViewChild = mRefreshableView.getChildAt(0);
if (null != scrollViewChild) {
return mRefreshableView.getScrollY() >= (scrollViewChild.getHeight() - getHeight());
}
return false;
}
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
public boolean isScrolledAtEnd() {
final View view = mScrollableView.getChildAt(0);
return view != null && (view.getHeight() - mScrollableView.getHeight()) == mScrollableView.getScrollY();
}
}
代码示例来源:origin: Wan7451/Wan_RecycleViewAdapter
@Override
protected boolean isReadyForPullEnd() {
View scrollViewChild = mRefreshableView.getChildAt(0);
if (null != scrollViewChild) {
return mRefreshableView.getScrollY() >= (scrollViewChild.getHeight() - getHeight());
}
return false;
}
代码示例来源:origin: 736008081/frameAndroid
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = com.mob.tools.utils.R.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
内容来源于网络,如有侵权,请联系作者删除!