下面列出了怎么用android.view.ViewTreeObserver.OnScrollChangedListener的API类实例代码及写法,或者点击链接到github查看源代码。
private void init() {
if (superListenerField != null) {
try {
mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
superListenerField.set(this, NOP);
} catch (Exception e) {
mSuperScrollListener = null;
}
}
}
/**
* Constructs a new IncognitoBottomSheetContent.
* @param activity The {@link Activity} displaying this bottom sheet content.
*/
public IncognitoBottomSheetContent(final Activity activity) {
LayoutInflater inflater = LayoutInflater.from(activity);
mView = inflater.inflate(R.layout.incognito_bottom_sheet_content, null);
View learnMore = mView.findViewById(R.id.learn_more);
learnMore.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HelpAndFeedback.getInstance(activity).show(activity,
activity.getString(R.string.help_context_incognito_learn_more),
Profile.getLastUsedProfile(), null);
}
});
final FadingShadowView shadow = (FadingShadowView) mView.findViewById(R.id.shadow);
shadow.init(
ApiCompatibilityUtils.getColor(mView.getResources(), R.color.toolbar_shadow_color),
FadingShadow.POSITION_TOP);
mScrollView = (ScrollView) mView.findViewById(R.id.scroll_view);
mScrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
@Override
public void onScrollChanged() {
boolean shadowVisible = mScrollView.canScrollVertically(-1);
shadow.setVisibility(shadowVisible ? View.VISIBLE : View.GONE);
}
});
}
private void init() {
if (superListenerField != null) {
try {
mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
superListenerField.set(this, NOP);
} catch (Exception e) {
mSuperScrollListener = null;
}
}
}
private void init() {
if (superListenerField != null) {
try {
mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
superListenerField.set(this, NOP);
} catch (Exception e) {
mSuperScrollListener = null;
}
}
}
private void init() {
if (superListenerField != null) {
try {
mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
superListenerField.set(this, NOP);
} catch (Exception e) {
mSuperScrollListener = null;
}
}
}