1
這裏是我到目前爲止的代碼。我應該改變什麼,使它看起來像下面的ASCII藝術?編程方式:在頂部的EditText和按鈕的Android的ListView在底部
private RelativeLayout mMainLayout;
private LinearLayout mButtonLayout;
private ListView mListView;
private EditText mMessageInput;
private Button mSendButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMainLayout = new RelativeLayout(this);
mMainLayout.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
setContentView(mMainLayout);
mMainLayout.setGravity(Gravity.BOTTOM);
mListView = new ListView(this);
mMainLayout.addView(mListView, 0);
mButtonLayout = new LinearLayout(this);
mButtonLayout.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT, 2f));
mMessageInput = new EditText(this);
mMessageInput.setMinimumHeight(200);
mButtonLayout.addView(mMessageInput, 0);
mSendButton = new Button(this);
mSendButton.setText(R.string.send);
mSendButton.setOnClickListener(this);
mButtonLayout.addView(mSendButton, 1);
mMainLayout.addView(mButtonLayout, 1);
}
-------------------------
|ListView |
| |
| |
| |
| |
| |
| |
| |
| |
-------------------------
| EditText |Button |
-------------------------