本文整理汇总了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;
}