Java Code Examples for android.text.Layout#getTopPadding()

The following examples show how to use android.text.Layout#getTopPadding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LayoutUtils.java    From Markwon with Apache License 2.0 5 votes vote down vote up
public static int getLineTopWithoutPadding(@NonNull Layout layout, int line) {
    final int top = layout.getLineTop(line);
    if (line == 0) {
        return top - layout.getTopPadding();
    }
    return top;
}
 
Example 2
Source File: CodeTextView.java    From Markwon with Apache License 2.0 5 votes vote down vote up
private static float getLineTop(@NonNull Layout layout, int line, float padding) {
    float value = layout.getLineTop(line) - padding;
    if (line == 0) {
        value -= layout.getTopPadding();
    }
    return value;
}