2012-11-06 6 views
0

버튼과 edittext를 framelayout에 추가했습니다. 문제는 버튼을 클릭 할 수있는 기능을 잃어 버리는 것 같습니다. 버튼을 클릭하면 키보드가 편집 문구에 나타납니다. 레이아웃에 button/editext 객체를 추가하여 어떻게 새 행에 나타나고 서로 영향을 미치지 않도록 할 수 있습니까? 패딩 옵션을 사용하여 이동하려고했으나 여전히 버튼을 클릭 할 수 없게 만듭니다. 여기 Android : 새 줄에 새 편집 문구 추가

내 코드입니다 : -

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); 

답변

1

FrameLayout으로 설정하면보기가 겹쳐집니다. setOrientation()으로 LinearLayout을 시도하십시오.

그리고 배치 용 패딩을 사용하지 마십시오. 여백과 채우기가 같지 않음.

+0

우수. 그것은 밟아 다녔다. –