Android - Example of scrollView

Here's another example of tutorial in android, it shows how to get scroll view like a webpage you scroll down and up.

mainactivity.java

package com.madindo.scrollview;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView view = (TextView) findViewById(R.id.TextView02);
String s="";
for (int i=0; i < 100; i++) {
s += "fedrianto.com ";
}
view.setText(s);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

}
main_activity.xml



 

Download -scrollView