Take the 2-minute tour ×

I have added a button and an edittext onto a framelayout. The problem is I appear to lose the functionality of being able to click the button. When I click the button, the keyboard appears for the edittext. How can I add button/editext objects into a layout so that they appear on a new row and do not affect each other. I was using the padding option to move them about, but this still causes the button to be non-clickable.

Here is my code: -

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

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

Button executeButton = new Button(this);



EditText text1 = new EditText(this);


text1.setHint("Enter Value");

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


share|improve this question

1 Answer 1

up vote 1 down vote accepted

FrameLayout will cause Views to overlap. Try LinearLayout with setOrientation().

And you don't use padding for placement. Padding is not same thing as a margin.

share|improve this answer
Excellent. That worked a tread. –  Martin Shinks Nov 6 '12 at 10:21

Your Answer


