RuntimeException: Binary XML file line #17: You must supply a layout_height attribute whie showing the popupmenu

后端 未结 4 373
遥遥无期
遥遥无期 2021-01-13 06:30
        public void showPopup(int group,int img_index,JSONArray json_ar,View v){

        PopupMenu pm=new PopupMenu(EditPhotosActivity.this,v);
        pm.getMenuIn         


        
4条回答
  •  猫巷女王i
    2021-01-13 07:11

    Although I was using AppCompat Theme, but I still had the same problem

    I found out that problem is in the declaration of the PopupMenu, and the context I am passing to it.

    I was using it like that:

    PopupMenu popup = new PopupMenu(getApplicationContext(),v)
    

    But it should be like this:

     PopupMenu popup = new PopupMenu(MyActivity.this,v)
    

提交回复
热议问题