如何在单击按钮时从按钮指向警报对话框?

How make alert dialog pointing from a button on click of button?

我有一个要求,我需要在其中显示一些内容,如下所示。

但是我如下图。

我用来获取上述对话框的代码如下。

ListView visitsListView = (ListView) vg.findViewById(R.id.lvDayRemindersList);
        //if ( visitsListView == null ) return;
        TextView noVisitDayTextView = (TextView) vg.findViewById(R.id.no_visits_day);
        if ( visitsListView == null && day != null )
        {
            //activityListDialog = new AlertDialog(vg.getContext());
            LayoutInflater li = (LayoutInflater) vg.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View v = li.inflate(R.layout.cal_month_day_list_view, null, false);
            visitsListView = (ListView) v.findViewById(R.id.today_list_view);
            //noVisitDayTextView = (TextView) vg.findViewById(R.id.today_list_view_title);
            //activityListDialog.setContentView(v);
            AlertDialog.Builder builder = new AlertDialog.Builder(vg.getContext());
            builder.setTitle(day);
            builder.setView(v);
            activityListDialog = builder.create();
            activityListDialog.setCanceledOnTouchOutside(true);
        }

单击网格时,我将调用如下所示的对话框。

if (isContainsData && isOnSelected) 
        {
            Logger.performanceLogEnd("CalendarMonthView-displayVisitListDialog");
            activityListDialog.show();
        } 

有人可以帮助实现这个目标吗?谢谢。

我注意到的一件事是没有用于填充对象 visitsListView 内容的代码。至少我没有看到代码。 visitsListView 在调用 findViewById() 时被使用了两次,这令人困惑。

如果您 post xml 布局 cal_month_day_list_view 和其他人,也许会更好。