当前位置: 首页>>代码示例>>Java>>正文


Java TextView.getTotalPaddingBottom方法代码示例

本文整理汇总了Java中android.widget.TextView.getTotalPaddingBottom方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.getTotalPaddingBottom方法的具体用法?Java TextView.getTotalPaddingBottom怎么用?Java TextView.getTotalPaddingBottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.getTotalPaddingBottom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: action

import android.widget.TextView; //导入方法依赖的package包/类
private boolean action(int what, TextView widget, Spannable buffer) {
    Layout layout = widget.getLayout();
    int padding = widget.getTotalPaddingTop() + widget.getTotalPaddingBottom();
    int areatop = widget.getScrollY();
    int areabot = (widget.getHeight() + areatop) - padding;
    int linetop = layout.getLineForVertical(areatop);
    int linebot = layout.getLineForVertical(areabot);
    int first = layout.getLineStart(linetop);
    int last = layout.getLineEnd(linebot);
    MyURLSpan[] candidates = (MyURLSpan[]) buffer.getSpans(first, last, MyURLSpan.class);
    int a = Selection.getSelectionStart(buffer);
    int b = Selection.getSelectionEnd(buffer);
    int selStart = Math.min(a, b);
    int selEnd = Math.max(a, b);
    if (selStart < 0 && buffer.getSpanStart(FROM_BELOW) >= 0) {
        selEnd = buffer.length();
        selStart = selEnd;
    }
    if (selStart > last) {
        selEnd = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
        selStart = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
    }
    if (selEnd < first) {
        selEnd = -1;
        selStart = -1;
    }
    int beststart;
    int bestend;
    int i;
    switch (what) {
        case 1:
            if (selStart != selEnd) {
                MyURLSpan[] link = (MyURLSpan[]) buffer.getSpans(selStart, selEnd, MyURLSpan
                        .class);
                if (link.length == 1) {
                    link[0].onClick(widget);
                    break;
                }
                return false;
            }
            return false;
        case 2:
            beststart = -1;
            bestend = -1;
            for (i = 0; i < candidates.length; i++) {
                int end = buffer.getSpanEnd(candidates[i]);
                if ((end < selEnd || selStart == selEnd) && end > bestend) {
                    beststart = buffer.getSpanStart(candidates[i]);
                    bestend = end;
                }
            }
            if (beststart >= 0) {
                Selection.setSelection(buffer, bestend, beststart);
                return true;
            }
            break;
        case 3:
            beststart = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
            bestend = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
            for (i = 0; i < candidates.length; i++) {
                int start = buffer.getSpanStart(candidates[i]);
                if ((start > selStart || selStart == selEnd) && start < beststart) {
                    beststart = start;
                    bestend = buffer.getSpanEnd(candidates[i]);
                }
            }
            if (bestend < Integer.MAX_VALUE) {
                Selection.setSelection(buffer, beststart, bestend);
                return true;
            }
            break;
    }
    return false;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:75,代码来源:LongClickableLinkMovementMethod.java


注:本文中的android.widget.TextView.getTotalPaddingBottom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。