本文整理了Java中android.widget.HorizontalScrollView.getViewTreeObserver()
方法的一些代码示例,展示了HorizontalScrollView.getViewTreeObserver()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HorizontalScrollView.getViewTreeObserver()
方法的具体详情如下:
包路径:android.widget.HorizontalScrollView
类名称:HorizontalScrollView
方法名:getViewTreeObserver
暂无
代码示例来源:origin: apps4av/avare
@Override
public void onGlobalLayout() {
mScrollView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
mScrollWidth = mScrollView.getChildAt(0).getMeasuredWidth()
- getWindowManager().getDefaultDisplay().getWidth();
}
});
代码示例来源:origin: stackoverflow.com
protected void onResume() {
super.onResume();
final HorizontalScrollView svInMenu = (HorizontalScrollView) findViewById(R.id.svInMenu);
ViewTreeObserver vto = svInMenu.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
svInMenu.scrollTo(svInMenu.getRight() / 4, 0);
}
});
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
private void initializeScrollForRtl() {
final HorizontalScrollView scroll =
(HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container);
if (scroll.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
final ViewTreeObserver observer = scroll.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
LinearLayout masterWallpaperList =
(LinearLayout) findViewById(R.id.master_wallpaper_list);
scroll.scrollTo(masterWallpaperList.getWidth(), 0);
scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
}
代码示例来源:origin: fookwood/Launcher3
public void onGlobalLayout() {
LinearLayout masterWallpaperList =
(LinearLayout) findViewById(R.id.master_wallpaper_list);
mWallpaperScrollContainer.scrollTo(masterWallpaperList.getWidth(), 0);
mWallpaperScrollContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
代码示例来源:origin: stackoverflow.com
final HorizontalScrollView hs = (HorizontalScrollView)findViewById(R.id.scroll);
ViewTreeObserver vto = hs.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
hs.getViewTreeObserver().removeGlobalOnLayoutListener(this);
maxScrollX = hs.getChildAt(0)
.getMeasuredWidth()-getWindowManager().getDefaultDisplay().getWidth();
}
});
hs.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.e("ScrollValue", Integer.toString(hs.getScrollX()));
if(hs.getScrollX() == maxScrollX){
Log.e("MaxRight", "MaxRight");
}
return false;
}
});
代码示例来源:origin: WeAreFairphone/FP2-Launcher
public void onGlobalLayout() {
LinearLayout masterWallpaperList =
(LinearLayout) findViewById(R.id.master_wallpaper_list);
scroll.scrollTo(masterWallpaperList.getWidth(), 0);
scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
代码示例来源:origin: fookwood/Launcher3
@Thunk void initializeScrollForRtl() {
if (Utilities.isRtl(getResources())) {
final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
LinearLayout masterWallpaperList =
(LinearLayout) findViewById(R.id.master_wallpaper_list);
mWallpaperScrollContainer.scrollTo(masterWallpaperList.getWidth(), 0);
mWallpaperScrollContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
}
代码示例来源:origin: stackoverflow.com
ViewTreeObserver vto = hsv.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener(){
@Override
public void onGlobalLayout() {
hsv.getViewTreeObserver().removeGlobalOnLayoutListener(this);
代码示例来源:origin: jjhesk/KickAssSlidingMenu
me.getViewTreeObserver().removeGlobalOnLayoutListener(this);
代码示例来源:origin: stackoverflow.com
observer = scroller.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
代码示例来源:origin: apps4av/avare
ViewTreeObserver vto = mScrollView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
代码示例来源:origin: stackoverflow.com
me.getViewTreeObserver().removeGlobalOnLayoutListener(this);
内容来源于网络,如有侵权,请联系作者删除!