Android - PopupWindow above a specific view

前端 未结 8 502
孤城傲影
孤城傲影 2020-12-30 23:50

I am developing an application for Android and I am using a popup window when the user clicks a specific menu bar object(consisting of small images lined up horizontally) on

8条回答
  •  感情败类
    2020-12-31 00:14

    Sample example:

    ScrollView scrollView = new ScrollView(context);
    popupWindow.setContentView(scrollView);
    scrollView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),                 
    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    int he=scrollView.getMeasuredHeight();
    popupWindow.showAsDropDown(items,0, -items.getHeight()-he);
    

提交回复
热议问题