TextMessageWithLinkAndIconPreference.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:chromium-for-android-56-debug-video 作者:
@Override
public View onCreateView(ViewGroup parent) {
    View view = super.onCreateView(parent);

    if (mNoBottomSpacing) {
        ApiCompatibilityUtils.setPaddingRelative(
                view,
                ApiCompatibilityUtils.getPaddingStart(view),
                view.getPaddingTop(),
                ApiCompatibilityUtils.getPaddingEnd(view),
                0);
    }

    ((TextView) view.findViewById(android.R.id.summary)).setMovementMethod(
            LinkMovementMethod.getInstance());

    // The icon is aligned to the top of the text view, which can be higher than the
    // ascender line of the text, and makes it look aligned improperly.
    TextView textView = (TextView) view.findViewById(
            getTitle() != null ? android.R.id.title : android.R.id.summary);
    FontMetrics metrics = textView.getPaint().getFontMetrics();
    ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
    ApiCompatibilityUtils.setPaddingRelative(
            icon, 0, (int) java.lang.Math.ceil(metrics.ascent - metrics.top), 0, 0);

    return view;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号