在GridView中加入了SlidingDrawer。如果把SlidingDrawer设置为android:layout_height="wrap_content" 时,会报错“SlidingDrawer cannot have UNSPECIFIED dimensions”,这主要是因为GidView中的一些子类需要有固定的高度,所以会报出该错误。
具体解决办法等有时间再研究一下吧。
//这是show一个PopupWindow
PopupWindow mPopupWindow;
public void showPopupWindow() {
LayoutInflater mLayoutInflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
View music_popunwindwow = mLayoutInflater.inflate(R.layout.portal_select_layout, null);
ListView portal_select_listView = (ListView) music_popunwindwow.findViewById(R.id.portal_select_listView);
ArrayList androi = new ArrayList();
for (int i = 0; i < 10; i++) {
androi.add(""+i);}
portal_select_listView.setAdapter( new ArrayAdapter(this,android.R.layout.simple_spinner_dropdown_item,androi));
//popwindow的宽度和按钮的宽度相同都是230
mPopupWindow = new PopupWindow(music_popunwindwow,230, LayoutParams.WRAP_CONTENT);
mPopupWindow.setFocusable(true);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.update();
//位置在R.id.button的正下方
mPopupWindow.showAsDropDown(findViewById(R.id.button), 0,5);
}
点击软键盘右下角的收起键时,如何才可以得到这个事件?
用通知:
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[defaultCenter addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[defaultCenter addObserver:self
selector:@selector(keyboardDidHide:)
name:UIKeyboardDidHideNotification
object:nil];
[defaultCenter addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:nil];