本文整理汇总了C#中android.getLayout方法的典型用法代码示例。如果您正苦于以下问题:C# android.getLayout方法的具体用法?C# android.getLayout怎么用?C# android.getLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.getLayout方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: right
protected internal override bool right(android.widget.TextView widget, android.text.Spannable
buffer)
{
android.text.Layout layout = widget.getLayout();
if (isSelecting(buffer))
{
return android.text.Selection.extendRight(buffer, layout);
}
else
{
return android.text.Selection.moveRight(buffer, layout);
}
}
示例2: onTakeFocus
public override void onTakeFocus(android.widget.TextView view, android.text.Spannable
text, int dir)
{
if ((dir & (android.view.View.FOCUS_FORWARD | android.view.View.FOCUS_DOWN)) != 0)
{
if (view.getLayout() == null)
{
// This shouldn't be null, but do something sensible if it is.
android.text.Selection.setSelection(text, text.Length);
}
}
else
{
android.text.Selection.setSelection(text, text.Length);
}
}
示例3: scrollBottom
/// <summary>Performs a scroll to bottom action.</summary>
/// <remarks>
/// Performs a scroll to bottom action.
/// Scrolls to the bottom of the document.
/// </remarks>
/// <param name="widget">The text view.</param>
/// <param name="buffer">The text buffer.</param>
/// <returns>True if the event was handled.</returns>
/// <hide></hide>
protected internal virtual bool scrollBottom(android.widget.TextView widget, android.text.Spannable
buffer)
{
android.text.Layout layout = widget.getLayout();
int lineCount = layout.getLineCount();
if (getBottomLine(widget) <= lineCount - 1)
{
android.text.method.Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop
(lineCount) - getInnerHeight(widget));
return true;
}
return false;
}
示例4: pageDown
protected internal override bool pageDown(android.widget.TextView widget, android.text.Spannable
buffer)
{
android.text.Layout layout = widget.getLayout();
bool selecting = isSelecting(buffer);
int targetY = getCurrentLineTop(buffer, layout) + getPageHeight(widget);
bool handled = false;
for (; ; )
{
int previousSelectionEnd = android.text.Selection.getSelectionEnd(buffer);
if (selecting)
{
android.text.Selection.extendDown(buffer, layout);
}
else
{
android.text.Selection.moveDown(buffer, layout);
}
if (android.text.Selection.getSelectionEnd(buffer) == previousSelectionEnd)
{
break;
}
handled = true;
if (getCurrentLineTop(buffer, layout) >= targetY)
{
break;
}
}
return handled;
}
示例5: scrollPageDown
/// <summary>Performs a scroll page up action.</summary>
/// <remarks>
/// Performs a scroll page up action.
/// Scrolls down by one page.
/// </remarks>
/// <param name="widget">The text view.</param>
/// <param name="buffer">The text buffer.</param>
/// <returns>True if the event was handled.</returns>
/// <hide></hide>
protected internal virtual bool scrollPageDown(android.widget.TextView widget, android.text.Spannable
buffer)
{
android.text.Layout layout = widget.getLayout();
int innerHeight = getInnerHeight(widget);
int bottom_1 = widget.getScrollY() + innerHeight + innerHeight;
int bottomLine = layout.getLineForVertical(bottom_1);
if (bottomLine <= layout.getLineCount() - 1)
{
android.text.method.Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop
(bottomLine + 1) - innerHeight);
return true;
}
return false;
}
示例6: scrollTop
/// <summary>Performs a scroll to top action.</summary>
/// <remarks>
/// Performs a scroll to top action.
/// Scrolls to the top of the document.
/// </remarks>
/// <param name="widget">The text view.</param>
/// <param name="buffer">The text buffer.</param>
/// <returns>True if the event was handled.</returns>
/// <hide></hide>
protected internal virtual bool scrollTop(android.widget.TextView widget, android.text.Spannable
buffer)
{
android.text.Layout layout = widget.getLayout();
if (getTopLine(widget) >= 0)
{
android.text.method.Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop
(0));
return true;
}
return false;
}
示例7: scrollDown
/// <summary>Performs a scroll down action.</summary>
/// <remarks>
/// Performs a scroll down action.
/// Scrolls down by the specified number of lines.
/// </remarks>
/// <param name="widget">The text view.</param>
/// <param name="buffer">The text buffer.</param>
/// <param name="amount">The number of lines to scroll by. Must be at least 1.</param>
/// <returns>True if the event was handled.</returns>
/// <hide></hide>
protected internal virtual bool scrollDown(android.widget.TextView widget, android.text.Spannable
buffer, int amount)
{
android.text.Layout layout = widget.getLayout();
int innerHeight = getInnerHeight(widget);
int bottom_1 = widget.getScrollY() + innerHeight;
int bottomLine = layout.getLineForVertical(bottom_1);
if (layout.getLineTop(bottomLine + 1) < bottom_1 + 1)
{
// Less than a pixel of this line is out of view,
// so we must have tried to make it entirely in view
// and now want the next line to be in view instead.
bottomLine += 1;
}
int limit = layout.getLineCount() - 1;
if (bottomLine <= limit)
{
bottomLine = System.Math.Min(bottomLine + amount - 1, limit);
android.text.method.Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop
(bottomLine + 1) - innerHeight);
return true;
}
return false;
}
示例8: scrollPageUp
/// <summary>Performs a scroll page up action.</summary>
/// <remarks>
/// Performs a scroll page up action.
/// Scrolls up by one page.
/// </remarks>
/// <param name="widget">The text view.</param>
/// <param name="buffer">The text buffer.</param>
/// <returns>True if the event was handled.</returns>
/// <hide></hide>
protected internal virtual bool scrollPageUp(android.widget.TextView widget, android.text.Spannable
buffer)
{
android.text.Layout layout = widget.getLayout();
int top_1 = widget.getScrollY() - getInnerHeight(widget);
int topLine = layout.getLineForVertical(top_1);
if (topLine >= 0)
{
android.text.method.Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop
(topLine));
return true;
}
return false;
}
示例9: scrollUp
/// <summary>Performs a scroll up action.</summary>
/// <remarks>
/// Performs a scroll up action.
/// Scrolls up by the specified number of lines.
/// </remarks>
/// <param name="widget">The text view.</param>
/// <param name="buffer">The text buffer.</param>
/// <param name="amount">The number of lines to scroll by. Must be at least 1.</param>
/// <returns>True if the event was handled.</returns>
/// <hide></hide>
protected internal virtual bool scrollUp(android.widget.TextView widget, android.text.Spannable
buffer, int amount)
{
android.text.Layout layout = widget.getLayout();
int top_1 = widget.getScrollY();
int topLine = layout.getLineForVertical(top_1);
if (layout.getLineTop(topLine) == top_1)
{
// If the top line is partially visible, bring it all the way
// into view; otherwise, bring the previous line into view.
topLine -= 1;
}
if (topLine >= 0)
{
topLine = System.Math.Max(topLine - amount + 1, 0);
android.text.method.Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop
(topLine));
return true;
}
return false;
}
示例10: getScrollBoundsRight
private int getScrollBoundsRight(android.widget.TextView widget)
{
android.text.Layout layout = widget.getLayout();
int topLine = getTopLine(widget);
int bottomLine = getBottomLine(widget);
if (topLine > bottomLine)
{
return 0;
}
int right_1 = int.MinValue;
{
for (int line = topLine; line <= bottomLine; line++)
{
int lineRight = (int)System.Math.Ceiling(layout.getLineRight(line));
if (lineRight > right_1)
{
right_1 = lineRight;
}
}
}
return right_1;
}
示例11: getScrollBoundsLeft
private int getScrollBoundsLeft(android.widget.TextView widget)
{
android.text.Layout layout = widget.getLayout();
int topLine = getTopLine(widget);
int bottomLine = getBottomLine(widget);
if (topLine > bottomLine)
{
return 0;
}
int left_1 = int.MaxValue;
{
for (int line = topLine; line <= bottomLine; line++)
{
int lineLeft = (int)Sharpen.Util.Floor(layout.getLineLeft(line));
if (lineLeft < left_1)
{
left_1 = lineLeft;
}
}
}
return left_1;
}
示例12: getBottomLine
private int getBottomLine(android.widget.TextView widget)
{
return widget.getLayout().getLineForVertical(widget.getScrollY() + getInnerHeight
(widget));
}
示例13: getTopLine
private int getTopLine(android.widget.TextView widget)
{
return widget.getLayout().getLineForVertical(widget.getScrollY());
}