本文整理汇总了Java中android.support.design.widget.AppBarLayout.OnOffsetChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java AppBarLayout.OnOffsetChangedListener方法的具体用法?Java AppBarLayout.OnOffsetChangedListener怎么用?Java AppBarLayout.OnOffsetChangedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.AppBarLayout
的用法示例。
在下文中一共展示了AppBarLayout.OnOffsetChangedListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchOffsetUpdates
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
protected void dispatchOffsetUpdates(AppBarLayout layout, int translationOffset) {
if (layout instanceof SmoothAppBarLayout) {
List listeners = ((SmoothAppBarLayout) layout).mOffsetChangedListeners;
int i = 0;
for (int z = listeners.size(); i < z; ++i) {
WeakReference ref = (WeakReference) listeners.get(i);
AppBarLayout.OnOffsetChangedListener listener = ref != null ? (AppBarLayout.OnOffsetChangedListener) ref.get() : null;
if (listener != null) {
listener.onOffsetChanged(layout, translationOffset);
}
}
}
}
示例2: onAttachedToWindow
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
initViews();
if (!isInEditMode()) {
mOnAppBarLayoutOffsetChangedListener = new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
SmoothCollapsingToolbarLayout.this.onOffsetChanged(appBarLayout, i);
}
};
getAppBarLayout().addOnOffsetChangedListener(mOnAppBarLayoutOffsetChangedListener);
}
}
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:16,代码来源:SmoothCollapsingToolbarLayout.java
示例3: addOnAppBarOffsetChangedListener
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
public void addOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
示例4: removeOnAppBarOffsetChangedListener
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
public void removeOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}
示例5: addOnAppBarOffsetChangedListener
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
public void addOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
mAppbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
示例6: removeOnAppBarOffsetChangedListener
import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
public void removeOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
mAppbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}