首页 > 代码库 > android 聊天室窗体

android 聊天室窗体

public class MainActivity extends Activity {
	 ScrollView scrollView;
	  Button button;
	  LinearLayout layout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
    //    File f=new File("");
        scrollView=(ScrollView)findViewById(R.id.scrollView1);
     //   scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        button=(Button)findViewById(R.id.button1);
        layout=(LinearLayout)findViewById(R.id.linear);
        button.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				TextView textView=new TextView(MainActivity.this);
				textView.setId(1);
				textView.setText("1");
				layout.addView(textView);
				scrollView.fullScroll(ScrollView.FOCUS_DOWN);
			}
		});
    }

android 聊天室窗体