2012-06-12 3 views
1

나는 매우 실망 문제가있어 후 사라집니다. 나는 PopupWindow을 상속 OnClickListener를를 구현하는 내 자신의 클래스를 구현했습니다. 문제가 시작 사용자 정의 셀렉터 버튼 배경을 추가 한 후안드로이드 PopupWindow 버튼을 <strong>안드로이드에 PopupWindow</strong>와 클릭

. 이 배경은 버튼을 클릭 한 후에 사라집니다 (새 활동 시작 및 팝업 해제). 그것은 단지 "빠른 클릭"후, 후 사라 "초점과을 클릭"하지 않습니다.

모든 아이디어/제안은 매우 appriciated 될 것입니다!

public class TestPopup extends PopupWindow implements OnClickListener 

protected LayoutInflater inflater; 
protected Activity caller; 
protected View popup; 
protected View layout; 

public TestPopup(Activity activity) { 
    super(activity); 
    popup = inflater.inflate(R.layout.popup, (ViewGroup) caller.findViewById(R.id.contentLayout)); 
    layout = popup.findViewById(R.id.layout); 

    popup.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); 

    Display display = caller.getWindowManager().getDefaultDisplay(); 
    setHeight(display.getHeight()); 
    setWidth(display.getWidth()); 
    setFocusable(true); 
    setContentView(popup); 

    // fix to allow Popup to be clickable! 
    setBackgroundDrawable(new BitmapDrawable()); 

    popup.setOnClickListener(this); 
    popup.findViewById(R.id.addButton).setOnClickListener(this); 
    popup.findViewById(R.id.deleteButton).setOnClickListener(this); 
} 

public void onClick(View v) { 
    Intent intent = null; 
    if (v.getId() == R.id.addButton) { 
     intent = new Intent(caller, AddActivity.class); 
     intent.putExtra(AddActivity.ACTION_ADD, true); 
    } else if (v.getId() == R.id.deleteButton) { 
     intent = new Intent(caller, AddActivity.class); 
     intent.putExtra(AddActivity.ACTION_DELETE, true); 
    } 

    if (intent != null) { 
     caller.startActivity(intent); 
    } 

    TestPopup.this.dismiss(); 
} 

Popup

답변

4

한 용액) (popup.invalidate 전화이고;을 입력 한 다음 팝업을 닫습니다.

+0

감사합니다! 답을 사용하여 비슷한 문제를 해결하십시오. – Song

+0

그게 내 비슷한 문제를 해결했지만, 그게 내가 필요로 애니메이션을 제거 ... : ( – yahya

관련 문제