2017-01-21 4 views
0

전에 내 활동은 팝업 창은 다음과 같이 정의하고있다 :안드로이드는 : setOverlapAnchor API 23

this.navigationMenuPopupWindow = new PopupWindow(View.inflate(this, R.layout.popup_navigation, null), ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 
this.navigationMenuPopupWindow.setWidth((int) this.getResources().getDimension(R.dimen.navigation_popup_width)); 
this.navigationMenuPopupWindow.setBackgroundDrawable(this.getDrawable(R.drawable.main_bg_navigation_menu)); 
this.navigationMenuPopupWindow.setElevation(43); 
this.navigationMenuPopupWindow.setFocusable(true); 
this.navigationMenuPopupWindow.setOutsideTouchable(true); 

내가 앵커에서 팝업 를 배치하고 싶습니다.

this.navigationMenuPopupWindow.setOverlapAnchor(false); 

불행히도,이 API 내가 같은 결과를 얻을 수있는 방법 (23) 필요하지만이 API (21)와 호환되는지 : 그래서 자연스럽게이 줄을 추가하려고?

내 앱 스타일을 수정하여이 문제를 해결할 수 있다고 생각하지만 정확한 방법을 모르겠습니다. 그건 그렇고, 이것은 응용 프로그램의 모든 PopupWindows에 영향을 미칠 수 있습니다. 문제는 없습니다. 도와 줘서 고마워!

+0

난이 도움이 될 것입니다 생각 http://stackoverflow.com/questions/9467026/changing-position-of-the-dialog -on-screen-android –

답변

0

PopupWindowCompat을 사용해야합니다.

PopupWindowCompat.setOverlapAnchor(this.navigationMenuPopupWindow,true);

PopupWindowCompat.setOverlapAnchor이 API 이전에는 구현이 없다는 것을 알고 있어야합니다 21