收藏点赞代码,发表评论代码

/*** 判断对话框中是否输入内容*/private boolean isEditEmply(){comment = commentEdit.getText().toString().trim();if(comment.equals("")){Toast.makeText(getApplicationContext(), "评论不能为空", Toast.LENGTH_SHORT).show();return false;}commentEdit.setText("");return true;}/*** 发表评论*/private void publishComment(){TuPianXiangQingPingLunBean bean = new TuPianXiangQingPingLunBean();bean.setId(count);bean.setCommentImgId(imgs[count%4]);bean.setCommentNickname("昵称"+count);bean.setCommentTime("13:"+count%6+"5");bean.setCommnetAccount("12345"+count);bean.setCommentContent(comment);comments.add(bean);count++;adapter.notifyDataSetChanged();}/*** 显示或隐藏输入法*/private void onFocusChange(boolean hasFocus){final boolean isFocus = hasFocus;(new Handler()).postDelayed(new Runnable() {public void run() {InputMethodManager imm = (InputMethodManager)commentEdit.getContext().getSystemService(INPUT_METHOD_SERVICE);if(isFocus)  {//显示输入法imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);}else{//隐藏输入法imm.hideSoftInputFromWindow(commentEdit.getWindowToken(),0);}}}, 100);}


Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注