Sometimes you need to dynamically add data. When the screen is full, the data needs to be displayed in a scroll manner. Here we mainly understand the meaning and usage of the scrollTo (0, off) method.
This is the general meaning.
Let's take a look at his usage:
Private void searchResultShow () {TextView textView = new TextView (AFSearchActivity. this); textView. setText ("Text View"); LinearLayout. layoutParams p = new LinearLayout. layoutParams (LinearLayout. layoutParams. MATCH_PARENT, LinearLayout. layoutParams. WRAP_CONTENT); textView. setPadding (30, 15, 0, 15); textView. setTextSize (30); textView. setTextColor (Color. WHITE); // Add a TextView to the linear layout of layout. addView (textView, p); ImageView imageView = new ImageView (AFSearchActivity. this); imageView. setImageResource (R. drawable. im_dottend_line); // Add an ImageView to the linear layout of layout. addView (imageView, p); if (sName = null | sName. equals ("") {textView. setText ("-");} else {textView. setText (sName); sName = ""; mHandler. post (mScrollToBottom) ;}} private Runnable mScrollToBottom = new Runnable () {@ Override public void run () {int off = layout. getMeasuredHeight ()-nameScroll. getHeight (); if (off> 0) {nameScroll. scrollTo (0, off );}}};