写信息的界面

1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:background="@color/white"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/EditText01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:padding="5dip"
android:scrollbars="vertical"
android:fadingEdge="vertical"
android:gravity="top"
android:textSize="22sp"
android:capitalize="sentences"/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:text="发送"
android:id="@+id/send"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
<EditText
android:id="@+id/EditText02"
android:layout_weight="1"
android:focusable="true"
android:layout_alignBottom="@id/send"
android:layout_toLeftOf="@id/send"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</EditText>
</RelativeLayout>
</LinearLayout>
2.code
public class ShowEditText extends Activity{
TextView content;
EditText inputcontent;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.editview);
content = (TextView) findViewById(R.id.EditText01);
inputcontent = (EditText) findViewById(R.id.EditText02);
Button send=(Button)findViewById(R.id.send);
send.setOnClickListener(sendListener);
}
private OnClickListener sendListener = new OnClickListener() {
public void onClick(View v) {
Editable text = (Editable)content.getText();
text.append(inputcontent.getText()+"\n");
inputcontent.setText("");
}
    };
}

你可能感兴趣的:(xml)