这是我到目前为止的代码。我应该改变什么,使它看起来像下面的 ASCII 艺术?
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 |
-------------------------