定制列表视图在自定义对话框中

时间:2014-06-26 08:29:08

标签: android

我想询问有关列表视图和对话框的内容

我有一个对话框,显示带有编辑文本,文本视图和列表视图的自定义布局

问题是,当对话框加载完毕后,此对话框内的everthings工作正常,可以通过clicklistener处理,但是......

listview没有响应onitemclicklistener ...

ve search about this but there没有办法解决我的问题...希望你能帮助我弄明白...... 非常感谢^^

这里是我的代码

li            = LayoutInflater.from(this);
        someLayout    = (LinearLayout)li.inflate(R.layout.d_bon_rokok_add_main, null);

        lblDate       = (TextView)someLayout.findViewById(R.id.d_bonRokokAddMain_lblTgl);
        txtStartDate  = (EditText)someLayout.findViewById(R.id.d_bonRokokAddMain_txtStartDate);
        lblTo         = (TextView)someLayout.findViewById(R.id.d_bonRokokAddMain_lblTo);
        txtEndDate    = (EditText)someLayout.findViewById(R.id.d_bonRokokAddMain_txtEndDate);
        btnSearch     = (Button)someLayout.findViewById(R.id.d_bonRokokAddMain_btnSearch);
        ll_add        = (LinearLayout)someLayout.findViewById(R.id.d_bonRokokAddMain_llBottom);
        btnSave_add   = (Button)someLayout.findViewById(R.id.d_bonRokokAddMain_btnNext);
        btnCancel_add = (Button)someLayout.findViewById(R.id.d_bonRokokAddMain_btnCancel);
        lvDialog = (ListView)someLayout.findViewById(R.id.d_bonRokokAddMain_lvDialog);

        initializeDate_d();

        cbRokokAdd      = (CheckBox)someLayout.findViewById(R.id.d_bonRokokAddMain_cbNewForm);
        cbHeaderDialog  = (CheckBox)someLayout.findViewById(R.id.d_bonRokokAddMain_cbHeader);

        cbRokokAdd.setChecked(true);

        hideWidget();

        cbRokokAdd.setOnCheckedChangeListener(switchControl);
        txtStartDate.setOnClickListener(dialogStartDate);
        txtStartDate.setKeyListener(null);
        txtEndDate.setOnClickListener(dialogEndDate);
        txtEndDate.setKeyListener(null);


        dialogItemList = login.dbResetData.GetSalesPlan();
        final bonrokok_salesplan_adapter dialogAdapter = new bonrokok_salesplan_adapter(this, dialogItemList);
        lvDialog.setAdapter(dialogAdapter);

        cbHeaderDialog.setOnCheckedChangeListener(cbHeaderControl);

        lvDialog.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                Log.d("Result", "Hey it`s work!!!");

            }
        });

        alert = new Dialog(this);
        alert.requestWindowFeature(Window.FEATURE_NO_TITLE);
        btnSave_add.setOnClickListener(dialogYes);
        btnCancel_add.setOnClickListener(dialogNo);
        alert.setContentView(someLayout);

        alert.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
        alert.getWindow().getAttributes().height = LayoutParams.WRAP_CONTENT;
        alert.show();

0 个答案:

没有答案