2012-07-17 3 views

답변

1

예 가능합니다. custom layout을 디자인하고 팝업 창에서 해당 레이아웃을 호출해야합니다.

내 생각에 이것은 pop up 코드입니다.

private void showPopUp() 
{ 
    final AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this); 
    helpBuilder.setTitle(""); 

    LayoutInflater inflater = getLayoutInflater(); 
    final View PopupLayout = inflater.inflate(R.layout.jobselection, null); 
    helpBuilder.setView(PopupLayout); 

    final AlertDialog helpDialog = helpBuilder.create(); 
    helpDialog.show(); 

    spn = (Spinner)PopupLayout.findViewById(R.id.spn); 
    caneclbtn = (ImageButton)PopupLayout.findViewById(R.id.cancelBtn); 
    selectallbtn = (ImageButton)PopupLayout.findViewById(R.id.selectBtn); 
    clearallbtn  = (ImageButton)PopupLayout.findViewById(R.id.clearallBtn); 
    jobentries  = (Button)PopupLayout.findViewById(R.id.entries); 

    jobList   = (ListView)PopupLayout.findViewById(R.id.list); 

    //ur code here. You can add your spineer with items. 
} 

이 블록에는 필요한 것을 쓸 수 있습니다. 행운을 빌어 요

+0

팝업창에 스피너가 있습니까? 방법? 너의 대답에 대해 –

+0

고마워. 이 잘 작동하지만 대화 상자 크기가 제한되어 있습니다. 대화 상자의 크기를 변경할 수 있습니까? –

+0

안드로이드에는 모든 페이지를 대화 상자로 표시 할 수있는 기능이 있습니다. 먼저 페이지를 만들고 android : theme = "@ android : style/Theme.Dialog"를 그 활동에 명시하십시오. 그리고 그것은 큰 크기가 될 것입니다. 크기 설정에 대한 –

2

당신은 팝업에 회 전자를 표시하고 싶다면 당신은 회 전자에 대해 android : spinnerMode = "dialog"를 설정해야합니다. 그렇습니다. 당신은 팝업을위한 custum 레이아웃을 만들고 그것을 팽창시켜야합니다. 내가 버튼을 편집 텍스트를 추가로

LayoutInflater layoutInflater = (LayoutInflater)IOStatusActivity.this.getSystemService(LAYOUT_INFLATER_SERVICE)  
final View popupView = layoutInflater.inflate(R.layout.popupai, null); 

final PopupWindow popupWindowDi = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); 

final TextView txtReadVal = (TextView)popupView.findViewById(R.id.lblPopUpAiReadFrmPLC); 
final EditText txtExpVal = (EditText)popupView.findViewById(R.id.txtPopUpAiExpVal); 
Button btnDismiss = (Button)popupView.findViewById(R.id.btnPopUpAiCancle);       
btnDismiss.setOnClickListener(new Button.OnClickListener(){ 
@Override 
public void onClick(View v) { 
popupWindowDi.dismiss(); 
}});` 

당신이 UR 스피너를 추가 할 수 있습니다

여기 내 코드입니다. 도움이되기를 바랍니다.

+0

여기에 팝업 레이아웃을 부 풀리는 예제 코드가 있습니다 : LayoutInflater layoutInflater = (LayoutInflater) IOStatusActivity.this.getSystemService (LAYOUT_INFLATER_SERVICE); \t \t \t \t \t 마지막보기 popupView = layoutInflater.inflate (R.layout.popupai, null); \t \t \t \t \t final PopupWindow popupWindowDi = new PopupWindow (popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); –

+0

여기 popupai는 xml에 만들 수있는 팝업의 레이아웃입니다. IOStatusActivity는 팝업을 표시하려는 활동의 이름입니다. –

+0

답장을 보내 주셔서 감사합니다. 스피너는 android : spinnerMode = "dialog"라는 팝업 창에서 잘 작동합니다. 자동 완성 텍스트 뷰를 어떻게 표시합니까? –

0

AutoCompleteTextView을 구현하는 대화 상자 (android.app.Dialog)를 사용하는 것이 좋습니다. 제 의견으로는 을 PopupWindow에 추가 할 수 없습니다 (예외가 발생합니다). 을 PopupWindow에 추가 할 수 있습니다. 팝업 대신 대화 상자를 사용하는 경우 두 가지 모두를 구현할 수 있습니다.