android 聊天室窗体

【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); } }); }




    推荐阅读