ikew0ng / SwipeBackLayout

An Android library that help you to build app with swipe back gesture.
Apache License 2.0
6.13k stars 1.4k forks source link

findViewById的优化及兼容26以及以上的使用 #164

Open DevenLiang opened 6 years ago

DevenLiang commented 6 years ago

SwipeBackActivity下这段: @Override public View findViewById(int id) { View v = super.findViewById(id); if (v == null && mHelper != null) return mHelper.findViewById(id); return v; } 返回的View,可以兼容sdk27,参考27的fbc做法:

@SuppressWarnings("TypeParameterUnusedInFormals")
@Override
public <T extends View> T findViewById(@IdRes int id) {
    return getDelegate().findViewById(id);
}

。 这个部分27版本Activity中,findViewById没有带强转的时候,使用其右滑框架,不用再做繁琐的处理强转View的问题。