答案 0 :(得分:1)
您需要抓住点击后的用户界面的位置,即过滤器图标 ImageView
。你必须使用
getLocationOnScreen() API and PopUpWindow component.
这是用于膨胀FilterUI的示例代码
text_click=(TextView)findViewById(R.id.text_click);
text_click.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int[] locationOfView = new int[2];
text_click.getLocationOnScreen(locationOfView);
final View mView = inflater.inflate(R.layout.activity_map_view, null, false);
final PopupWindow popUp = new PopupWindow(mView, 500, 500, false);
popUp.setTouchable(true);
popUp.setFocusable(true);
popUp.setOutsideTouchable(true);
popUp.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext,android.R.color.transparent)));
popUp.showAtLocation(mView, Gravity.NO_GRAVITY, locationOfView[0], (locationOfView[1]+ text_click.getHeight()));
}
});