에서 편집. 나는 다음과 같이이 작업을 수행 :나는 다음과 같은 내용으로 안드로이드 XML 파일이 레이아웃을 부풀려 코드
부풀려 XML :
LayoutInflater inflater = (LayoutInflater) MainActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.quitgame, null);
이하여 ImageButton 편집하십시오 : 그러나
ImageView imgView = (ImageView)findViewById(R.id.ivQuit);
ImageButton imgBtnYes = (ImageButton)findViewById(R.id.btnYes);
ImageButton imgBtnNo = (ImageButton)findViewById(R.id.btnNo);
RelativeLayout.LayoutParams relParams = (RelativeLayout.LayoutParams)imgBtnYes.getLayoutParams();
relParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
imgBtnYes.setLayoutParams(relParams);
을만큼의 LayoutParams와 세 개의 코드 라인은 내가 함께 만든 PopupWindow 존재이기 때문에 팽창 된 뷰는 나타나지 않습니다. 이 줄에 오류가 숨겨져있는 것 같습니다.
RelativeLayout.LayoutParams relParams = (RelativeLayout.LayoutParams)imgBtnYes.getLayoutParams();
그러나 나는 그 이유를 알지 못합니다.
아무에게도이 코드 줄 때문에 PopupWindows가 표시되지 않는 이유를 누구에게 말해 줄 수 있습니까? PopupWindow 자체 때문이거나 LayoutInflater 때문입니까?
이'ImageView imgView = (ImageView) findViewById (R.id.ivQuit)'는 ImageButton과 마찬가지로'ImageView imgView = (ImageView) layout.findViewById (R.id.ivQuit)'이어야합니다. – Raghunandan
대단히 감사합니다! 이제 작동합니다. 그 코드의 라인에 오류가 숨겨져 있다고 잠시 생각조차하지 않았다 ... – Mister004
당신은 똑같이 대답 할 수 있도록 대답으로 게시 할 것입니다. – Raghunandan