答えが見つからなかった別の質問: RelativeLayout があり、右端にボタンがあり、左端に ImageButton があるはずです。そして、私はこれを整理する方法がわかりません。
私が試しているのは:
RelativeLayout TopLayout = (RelativeLayout) findViewById(R.id.topLayout);
TopLayout.removeAllViews();
TopLayout.setPadding(m_TableRowPadding_px, 8, m_TableRowPadding_px, 4);
RelativeLayout.LayoutParams bParams = new RelativeLayout.LayoutParams(m_Resources
.getDimensionPixelSize(R.dimen.ButtonWidth), m_DefaultButtonHeight_px);
bParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
bParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
Button itemAddButton = new Button(this);
itemAddButton.setLayoutParams(bParams);
itemAddButton.setText(m_Resources.getString(R.string.add_item_button));
itemAddButton.setOnClickListener(new View.OnClickListener()
{...});
TopLayout.addView(itemAddButton);
RelativeLayout.LayoutParams ibParams = new RelativeLayout.LayoutParams(MIN_IMG_BUTTON_WIDTH,
m_DefaultButtonHeight_px);
ibParams.addRule(RelativeLayout.LEFT_OF, itemAddButton.getId());
ImageButton speechButton = new ImageButton(this);
speechButton.setLayoutParams(ibParams);
speechButton.setContentDescription(m_Resources.getString(R.string.AddSpeechItemString));
speechButton.setOnClickListener(new View.OnClickListener()
{... });
speechButton.setImageDrawable(m_Resources.getDrawable(R.drawable.micro2));
TopLayout.addView(speechButton);
}
しかし、結果として、(必要に応じて) 右側にボタンが表示され、左側に ImageButton が表示されます。:(
誰でも私を助けることができますか?うーん
乾杯
クリス