0

フレームレイアウトにボタンと編集テキストを追加しました。問題は、ボタンをクリックできる機能が失われているように見えることです。ボタンをクリックすると、編集テキスト用のキーボードが表示されます。ボタン/editext オブジェクトをレイアウトに追加して、それらが新しい行に表示され、互いに影響を与えないようにするにはどうすればよいですか。パディングオプションを使用してそれらを移動していましたが、それでもボタンをクリックできなくなります。

これが私のコードです: -

FrameLayout reportLayout = (FrameLayout) findViewById(R.id.reportDetailLayout);

FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
        LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

Button executeButton = new Button(this);

executeButton.setClickable(true);

executeButton.setOnClickListener(handleOnClick(executeButton));

EditText text1 = new EditText(this);

executeButton.setText("Execute");
executeButton.setMinimumHeight(10);
executeButton.setMinimumWidth(150);

text1.setId(1);
text1.setHint("Enter Value");

executeButton.setPadding(0, 0, 0, 0);
text1.setPadding(12, 70, 0, 0);

executeButton.setLayoutParams(params);
text1.setLayoutParams(params);

reportLayout.addView(executeButton);
reportLayout.addView(text1);
4

1 に答える 1

1

FrameLayoutビューがオーバーラップします。で試しLinearLayoutてくださいsetOrientation()

また、配置にパディングを使用しません。パディングはマージンと同じではありません

于 2012-11-06T09:52:11.587 に答える