继续上一篇,这篇还是异常,有需要的尽管看看吧。
7.在activity中复写onBackPressed()其中有super.onBackPressed(),按下back键后直接退出了,没有按照代码那样需要按两次退出,然后注释掉super.onBackPressed()再试,一切ok了。
7.在activity中复写onBackPressed()其中有super.onBackPressed(),按下back键后直接退出了,没有按照代码那样需要按两次退出,然后注释掉super.onBackPressed()再试,一切ok了。
8.界面的title背景,在右侧有空白,在小米
2A手机这样,经过查看找到了原因。
方法:android:layout_width="wrap_content" 改为 android:layout_width="match_parent"
9.Popupwindow中添加了listview,但是ListView的setOnItemClickListener(
)失去了点击效果(小米 2A手机)
方法:给Popupwindow设置setFocusable(true)
10.listview滑动时背景闪烁:
10.listview滑动时背景闪烁:
方法:设置两个属性,android:cacheColorHint="@color/gray_light"
android:background="@color/gray_light"
11.点击空白处,软键盘隐藏
方法:
InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction() == MotionEvent.ACTION_DOWN){ if(getCurrentFocus()!=null && getCurrentFocus().getWindowToken()!=null){
manager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
return super.onTouchEvent(event);
}
// TODO Auto-generated method stub
if(event.getAction() == MotionEvent.ACTION_DOWN){ if(getCurrentFocus()!=null && getCurrentFocus().getWindowToken()!=null){
manager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
return super.onTouchEvent(event);
}
注意:manager必须在onCreate( )方法之后再初始化(就是在此方法中初始化)
12.webview加载H5的页面,出不来,后来加上webview.getSettings().setJavaScriptEnabled(true);后可以了