Example usage for android.widget ScrollView fullScroll

List of usage examples for android.widget ScrollView fullScroll

Introduction

In this page you can find the example usage for android.widget ScrollView fullScroll.

Prototype

public boolean fullScroll(int direction) 

Source Link

Document

Handles scrolling in response to a "home/end" shortcut press.

Usage

From source file:Main.java

public static void scrollDown(final ScrollView view) {
    view.post(() -> view.fullScroll(View.FOCUS_DOWN));
}

From source file:Main.java

/**
 * E.g. when using previous-next facility you need to make sure the scroll view's position is back at the top of the screen
 *//*from www  .  j ava2s. c  o m*/
public static void scrollToTop(int scrollViewId, Activity activity) {
    ScrollView sv = (ScrollView) activity.findViewById(scrollViewId);
    sv.fullScroll(View.FOCUS_UP);
    sv.setSmoothScrollingEnabled(true);
}

From source file:Main.java

public static void scrollToBottom(final ScrollView scroll) {
    scroll.post(new Runnable() {
        public void run() {
            scroll.fullScroll(ScrollView.FOCUS_DOWN);
        }//from w w w  . j a va 2  s  . com
    });
}

From source file:Main.java

public static void scrollToBottom(final ScrollView sv) {
    Handler handler = new Handler();
    handler.post(new Runnable() {
        @Override/* w w  w  . j  a va2 s. c o m*/
        public void run() {
            sv.fullScroll(ScrollView.FOCUS_DOWN);
        }
    });
}

From source file:Main.java

public static void scrollToBottom(final ScrollView scroll) {
    if (scroll != null) {
        scroll.post(new Runnable() {

            @Override//w  w w. j  ava  2s.  co m
            public void run() {
                scroll.fullScroll(View.FOCUS_DOWN);
            }
        });
    }
}

From source file:cn.bingoogolapple.refreshlayout.util.BGARefreshScrollingUtil.java

public static void scrollToBottom(final ScrollView scrollView) {
    if (scrollView != null) {
        scrollView.post(new Runnable() {
            @Override/*www  . j  a  v  a 2s  .c o  m*/
            public void run() {
                scrollView.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }
}

From source file:com.lanma.customviewproject.utils.ScrollingUtil.java

/**
 * ScrollView//from  w w w  . j av a2 s .c  om
 */
public static void scrollToBottom(final ScrollView scrollView) {
    if (scrollView != null) {
        scrollView.post(new Runnable() {
            @Override
            public void run() {
                scrollView.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }
}

From source file:com.idevity.card.read.ShowLog.java

/**
 * Method onCreateView./*from   w w w . ja  va 2 s .co  m*/
 * 
 * @param inflater
 *            LayoutInflater
 * @param container
 *            ViewGroup
 * @param savedInstanceState
 *            Bundle
 * @return View
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Globals g = Globals.getInstance();

    // get the log string buffer from the fragment activity intent

    String logStringBuffer = g.getLogData();

    // Create the view
    View log = inflater.inflate(R.layout.activity_show_log, container, false);

    // Get the text view associated with the log
    TextView fullLog = (TextView) log.findViewById(R.id.readerlog2);
    ScrollView scroll = (ScrollView) log.findViewById(R.id.scrollViewLog);

    fullLog.setText(logStringBuffer);
    scroll.fullScroll(View.FOCUS_DOWN);

    // return the view
    return log;
}

From source file:com.example.android.google.wearable.app.MainActivity.java

private void scroll(final int scrollDirection) {
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scroll);
    scrollView.post(new Runnable() {
        @Override//from   w  w  w .  j  a va 2  s .c o  m
        public void run() {
            scrollView.fullScroll(scrollDirection);
        }
    });
}

From source file:org.openoverlayrouter.noroot.logActivity.java

public void refresh() {

    StringBuffer contents = new StringBuffer();

    final StringBuffer fixedContents = contents;

    try {/*from   w  w w  .  jav a 2 s  .  c  o  m*/
        RandomAccessFile logFile = new RandomAccessFile(log_file, "r");
        if (logFile.length() > maxReadBytes) {
            logFile.seek(logFile.length() - maxReadBytes);
        }
        String currentLine = logFile.readLine();
        while (currentLine != null) {

            if (currentLine != null) {
                contents.append(currentLine);
                contents.append('\n');
            }
            currentLine = logFile.readLine();
        }
        try {
            if (logFile != null) {
                logFile.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {

    }

    mHandler.post(new Runnable() {
        public void run() {

            // Put the file contents into the TextView
            TextView log = (TextView) llLayout.findViewById(R.id.logView);
            log.setText(fixedContents);

            // Auto scroll to the bottom
            final ScrollView scroll = (ScrollView) llLayout.findViewById(R.id.scrollView1);
            scroll.post(new Runnable() {
                public void run() {
                    scroll.fullScroll(View.FOCUS_DOWN);
                }
            });
            if (myDialog != null) {
                myDialog.dismiss();
                myDialog = null;
            }
        }
    });
}