我正在开发一个应用程序,因为我为日历 View 创建了一个类。现在我想打开那个日历 Activity 作为弹出窗口,我不知道如何创建弹出窗口,所以我搜索了谷歌并得到了以下代码,但该代码只打开了日历类的用户界面。那么有人能告诉我该怎么做吗?
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
LayoutInflater layoutInflater
= (LayoutInflater)getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.my_calendar_view, null);
final PopupWindow popupWindow = new PopupWindow(
popupView,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(200);
popupWindow.setHeight(500);
popupWindow.showAsDropDown(b, 500, 30);
}
});
}
最佳答案
android:theme="@android:style/Theme.Dialog
在您的 list 文件中,在您的类名的 Activity block 中添加上述语句
关于android - 我们可以在弹出窗口中打开一个 Activity 吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19606578/