android - PopupView.showAtLocation is undefined for the type View -
i working on app in display contextmenu
. now, when 1 of menu items in contextmenu
pressed, display popupwindow
. have found examples of how use popupwindow
on internet still have problem. have following code:
layoutinflater layoutinflater = (layoutinflater) getbasecontext().getsystemservice(layout_inflater_service); view popupview = layoutinflater.inflate(r.layout.popup, null); final popupwindow popupwindow = new popupwindow(popupview, layoutparams.wrap_content, layoutparams.wrap_content); popupview.showatlocation(this.findviewbyid(r.id.main_layout), gravity.center, 0, 0);
and in activity's xml file:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#232323" > .... </relativelayout>
i thought should work, following error message:
"the method showatlocation(view, int, int, int) undefined type view"
what mean? giving showatlocation view , 3 integers, right? what's problem? guys have ideas?
you calling popview. instead should call popupwindow.
this method popupwindow not view
Comments
Post a Comment