Button add;
PopupWindow popupWindow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popup);
// 팝업 윈도우를 출력하기 위한 버튼
add = (Button) findViewById(R.id.add);
add.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.add:
/* 윈도우 출력 */
break;
}
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.sidemenu,
null);
popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
popupWindow.showAsDropDown(popupView, 80, 320);
Button btnexit = (Button) popupView
.findViewById(R.id.popup_close);
btnexit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
현재 다음 소스로 팝업 윈도우를 띄우고 있습니다.
그런데 각 핸드폰 기종마다 팝업이 나타나는 위치가 다른데요
이것을 모든 디바이스에서 화면 중앙에 나타나게 할 수 있는 방법이 없을까요?