zoukankan      html  css  js  c++  java
  • 自定义的dialog,解决键盘不同层,不能输入的问题

    纯代码,无讲解,一看就会明白的:

     1     final AlertDialog dlg=new AlertDialog.Builder(this).create();
     2     View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.user_tag_personal, null);
     3     dlg.setView(view);
     4     dlg.show();
     5     Window window=dlg.getWindow();
     6     window.setContentView(R.layout.user_tag_personal);
     7                 
     8     RelativeLayout userTagLayout=(RelativeLayout) view.findViewById(R.id.userTagLayout);
     9                                                 
    10     final EditText et=(EditText) window.findViewById(R.id.user_tag);
    11                 
    12     ImageButton close=(ImageButton) window.findViewById(R.id.close_drop_out);
    13     close.setOnClickListener(new OnClickListener() {
    14                     
    15         @Override
    16         public void onClick(View arg0) {
    17             // TODO Auto-generated method stub
    18             dlg.dismiss();
    19         }
    20     });
    21     TextView yes_drop_out=(TextView) window.findViewById(R.id.yes_drop_out);
    22     yes_drop_out.setOnClickListener(new OnClickListener() {
    23                     
    24         @Override
    25         public void onClick(View arg0) {
    26         // TODO Auto-generated method stub
    27             final String changeUserPersonnalTag=et.getText().toString();
    28             //if (changeUserPersonnalTag!=null&&!changeUserPersonnalTag.equals("")) {
    29                 String url="http://172.27.211.1/guodouRecipe/servlet/changeUserPersonnalTagServlet";
    30                 CustomRequest postRequest=new CustomRequest(Method.POST, url, new Listener<String>() {
    31 
    32                     @Override
    33                     public void onResponse(String ret) {
    34                         if(ret.equals("true")){
    35                             if(changeUserPersonnalTag!=null&&!changeUserPersonnalTag.equals("")){
    36                                 user_tag_personnal_text.setText(et.getText().toString());    
    37                                 myHandler.sendEmptyMessage(0);
    38                             }else{
    39                                 user_tag_personnal_text.setHint("未填写");
    40                                 Toast.makeText(getApplicationContext(), "没有编辑", 0).show();
    41                             }                                                                                    
    42                         }
    43                                                                                 
    44                     }
    45                 }, new ErrorListener(){
    46 
    47                     @Override
    48                     public void onErrorResponse(VolleyError arg0) {
    49                     // TODO Auto-generated method stub
    50                         myHandler.sendEmptyMessage(1);
    51                     }});                
    52                 postRequest.setParam("userName", userName);
    53                 postRequest.setParam("changeUserPersonnalTag", changeUserPersonnalTag);
    54                 requestQueue.add(postRequest);
    55                                                         
    56         //} else {
    57         //    Toast.makeText(getApplicationContext(), "没有编辑", 0).show();
    58         //}
    59                 
    60         }
    61     });
    62     TextView no_drop_out=(TextView) window.findViewById(R.id.no_drop_out);
    63     no_drop_out.setOnClickListener(new OnClickListener() {
    64                     
    65         @Override
    66         public void onClick(View arg0) {
    67             // TODO Auto-generated method stub
    68             dlg.dismiss();
    69         }
    70     });
  • 相关阅读:
    RHEL7挂载ISO做本地yum
    服务器虚拟化架构突出优势
    国内公共DNS
    世界上最小的发行版之一Tiny Core
    VMware v12.1.1 专业版以及永久密钥
    Webbench网站压力测试
    Web.xml配置详解之context-param
    SpringMvc自动代理
    SpringMvc aop before
    SpringMvc 面向切面1
  • 原文地址:https://www.cnblogs.com/jiuqing/p/4055966.html
Copyright © 2011-2022 走看看