how to scroll in android???
- by antony
I create a program to add check boxes dynamically.But i cant scroll down.I add the code here ,Pls HELP......
package dyntodo.pack;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Button;
import android.widget.TextView;
public class dynact extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView)findViewById(R.id.textview);
final EditText task = (EditText)findViewById(R.id.task);
Button add = (Button)findViewById(R.id.add);
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
addTask(task.getText().toString());
}
});
}
public void addTask(String task)
{
LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
final CheckBox chk = new CheckBox(this); //Creating checkbox objects…..
chk.setText(task);
layout.addView(chk);
chk.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
chk.setVisibility(5);
}
});
}
}