Sometimes you need to add data dynamically, the screen is full, and the data needs to be displayed. Here the main understanding of the Scrollto (0, off) method of the meaning of shouting usage.
The meaning does not say, probably the meaning is like this.
Here's how he uses it:
Copy Code code as follows:
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
Layout.addview (TextView, p);
ImageView ImageView = new ImageView (afsearchactivity.this);
Imageview.setimageresource (R.drawable.im_dottend_line);
Add a ImageView to the linear layout
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);
}
}
};