错误日志:
代码:
public class ChatActivity extends BaseActivity implements OnClickListener {
public static final String COPY_IMAGE = "EASEMOBIMG";
public static final int REQUEST_CODE_COPY_AND_PASTE = 11;
private ImageView micImage;
private Drawable[] micImages;
private View more;
private LinearLayout expressionContainer;
private LinearLayout btnContainer;
// 给谁发送消息
private ImageView iv_emoticons_normal;
private ImageView iv_emoticons_checked;
private RelativeLayout edittext_layout;
private Button btnMore;
private ListView listView;
private InputMethodManager manager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
}
/**
* initView
*/
protected void initView() {
micImage = (ImageView) findViewById(R.id.mic_image);
more = findViewById(R.id.more);
listView = (ListView) findViewById(R.id.list);
btnContainer = (LinearLayout) findViewById(R.id.ll_btn_container);
expressionContainer = (LinearLayout) findViewById(R.id.ll_face_container);
}
@Override
public void onClick(View v) {
edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_active);
more.setVisibility(View.GONE);
iv_emoticons_normal.setVisibility(View.VISIBLE);
iv_emoticons_checked.setVisibility(View.INVISIBLE);
expressionContainer.setVisibility(View.GONE);
btnContainer.setVisibility(View.GONE);
}
private void setUpView() {
manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
listView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
more.setVisibility(View.GONE);
iv_emoticons_normal.setVisibility(View.VISIBLE);
iv_emoticons_checked.setVisibility(View.INVISIBLE);
expressionContainer.setVisibility(View.GONE);
btnContainer.setVisibility(View.GONE);
return false;
}
});
}
/**
* 显示或隐藏图标按钮页
*
* @param view
*/
public void more(View view) {
if (more.getVisibility() == View.GONE) {
System.out.println("more gone");
hideKeyboard();
more.setVisibility(View.VISIBLE);
btnContainer.setVisibility(View.VISIBLE);
expressionContainer.setVisibility(View.GONE);
} else {
if (expressionContainer.getVisibility() == View.VISIBLE) {
expressionContainer.setVisibility(View.GONE);
btnContainer.setVisibility(View.VISIBLE);
iv_emoticons_normal.setVisibility(View.VISIBLE);
iv_emoticons_checked.setVisibility(View.INVISIBLE);
} else {
more.setVisibility(View.GONE);
}
}
}
/**
* 点击文字输入框
*
* @param v
*/
public void editClick(View v) {
listView.setSelection(listView.getCount() - 1);
if (more.getVisibility() == View.VISIBLE) {
more.setVisibility(View.GONE);
iv_emoticons_normal.setVisibility(View.VISIBLE);
iv_emoticons_checked.setVisibility(View.INVISIBLE);
}
}
public List<String> getExpressionRes(int getSum) {
List<String> reslist = new ArrayList<String>();
for (int x = 1; x <= getSum; x++) {
String filename = "ee_" + x;
reslist.add(filename);
}
return reslist;
}
/**
* 隐藏软键盘
*/
private void hideKeyboard() {
if (getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getCurrentFocus() != null)
manager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}
求解错误在哪里?
------解决方案--------------------
在hideKeyboard这边加个断点看看吧
------解决方案--------------------