Professional Documents
Culture Documents
Project : EditTextDemo
<TableRow
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:layout_margin = "10dip"
android:gravity = "center_horizontal" >
<EditText
android:id = "@+id/editText"
android:layout_width = "240dip"
android:layout_height = "wrap_content"
android:layout_marginTop = "2dip"
android:inputType = "textAutoComplete"
android:hint = "Enter Text Here!" >
</EditText>
<Button
android:id = "@+id/button"
android:layout_width = "50dip"
android:layout_height = "wrap_content"
android:text = "OK" >
</Button>
</TableRow>
<TextView
android:id = "@+id/textView"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:layout_margin = "10dip"
android:background = "#252525" >
</TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:layout_margin = "10dip"
android:gravity = "center_horizontal" >
<EditText
android:id = "@+id/editText"
android:layout_width = "240dip"
android:layout_height = "wrap_content"
android:layout_marginTop = "2dip"
android:inputType = "textAutoComplete"
android:hint = "Enter Text Here!" >
</EditText>
<TextView
android:id = "@+id/textView"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:layout_margin = "10dip"
android:background = "#252525" >
</TextView>
editText = (EditText)findViewById(R.id.editText);
textView = (TextView)findViewById(R.id.textView);
button = (Button)findViewById(R.id.button);
button.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
textView.setText( editText.getText() );
}
});
}
}
EditText editText;
Button button;
TextView textView;
editText = (EditText)findViewById(R.id.editText);
button = (Button)findViewById(R.id.button);
button.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
textView.setText( editText.getText() );
}
});
textView.setText( editText.getText() );
drbomkung@gmail.com