2017-01-06 5 views
0

私はListViewです。各リスト項目は、一度クリックすると、ダイアログを表示するカードのようなものです。しかし、私の問題は、それがスマートフォンでは完全に動作しているが、タブレットでは動作していないということです。私はダイアログがカードの中央に表示されるようにしたいが、それはカードの下に表示されている。androidのリスト項目の前にダイアログを表示できません

私はTextViewをクリックして呼び出すダイアログクラスを持っています。

コードのためにそれ //アダプタのコード

viewHolder.customerName.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 

      getCustomerProfile(order_id, mContext); 
     } 
    }); 


    public void getCustomerProfile(final String orderid, Context context) { 

    new GetCustomerData().execute(new Config().userProfile, orderid); 



} 


    public class GetCustomerData extends AsyncTask<String, Integer, String> { 


    @Override 
    protected String doInBackground(String... params) { 
     try { 
      String link = (String) params[0]; 
      String id = (String) params[1]; 
      String data = URLEncoder.encode("orderid", "UTF-8") + "=" + URLEncoder.encode(id, "UTF-8"); 
      URL url = new URL(link); 
      URLConnection conn = url.openConnection(); 
      conn.setDoOutput(true); 
      OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); 
      wr.write(data); 
      wr.flush(); 
      BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); 
      StringBuilder sb = new StringBuilder(); 
      String line = null; 

      //Read Server Response 
      while ((line = reader.readLine()) != null) { 
       sb.append(line); 
       break; 
      } 
      return sb.toString(); 
     } catch (Exception e) { 
      return new String("Exception : " + e.getMessage()); 
     } 
    } 


    protected void onPostExecute(String s) { 

     if (!s.equals("exception")) { 
      try { 
       JSONObject obj = new JSONObject(s); 
       JSONObject object = obj.getJSONObject("result"); 


       name = object.getString("name"); 
       number = object.getString("mobile"); 
       if (object.getString("pic").length() > 0) { 
        pic = new Config().profilepiclink + object.getString("pic"); 
       } else 
        pic = "http://trackback.net/wp-content/uploads/2015/02/Dummy-profile-picture.png"; 


      } catch (Exception e) { 
       e.printStackTrace(); 
      } 
     } else { 

     } 

     Dialog_Call_User dc = new Dialog_Call_User((Activity) mContext,name, pic, number, mContext); 

     dc.getWindow().setLayout(width/2, height/2); 
     dc.show(); 

    } 


} 

今、私は中央

http://prntscr.com/ds4iwx

答えて

0

にするのではなく、カードの下部にdilaodている問題のスクリーンショットあなたのカスタムレイアウトダイアログが問題だと思います。

関連する問題