2013-01-19 51 views

回答

0

查看看起來是這樣的:

View view = getLayoutInflater().inflate(R.layout.SOME_LAYOUT, false); 
Button button1 = (Button) view.findViewById(R.id.BUTTON1_ID); 
button1.setOnClickListener(...start new Activity); 
Button button2 = (Button) view.findViewById(R.id.BUTTON2_ID); 
button2.setOnClickListener(...start new Activity); 

設置此視圖內容:

PopupWindow popup = new PopupWindow(getContext()); 
popup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); 
popup.setContentView(view); 
popup.setWidth(view.getWidth()); 
popup.setHeight(view.getHeight()); 
popup.setFocusable(true); 
popup.showAsDropDown(PARENT_VIEW); 

View是虛增佈局至極擁有一套點擊監聽兩個按鈕。父視圖是在點擊時顯示此彈出窗口。

祝你好運!