Guest User

Untitled

a guest
Aug 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. LayoutParams not showing
  2. public void onCreate(Bundle savedInstanceState) {
  3. super.onCreate(savedInstanceState);
  4. setContentView(R.layout.main);
  5.  
  6. LinearLayout ll=(LinearLayout)findViewById(R.id.linearlayout);
  7.  
  8.  
  9.  
  10. for(int k=0;k<10;k++)
  11. { TableRow tr=new TableRow(this);
  12. tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  13. tr.setId(k);
  14.  
  15. for(int s=0;s<10;s++)
  16. {
  17. EditText edt=new EditText(this);
  18. Log.i("SS","setting layout params for textview "+s+k);
  19. edt.setText("abc "+s+k+" ");
  20.  
  21.  
  22. edt.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  23. ViewGroup.LayoutParams p=edt.getLayoutParams();
  24.  
  25. Log.i("SS","edt params "+p.height +" "+p.width);
  26. tr.addView(edt);
  27. }
  28. ll.addView(tr);
  29. }
  30.  
  31.  
  32.  
  33. }
  34.  
  35. TableRow tr = new TableRow(this);
  36. TableLayout.LayoutParams tableRowParams=
  37. new TableLayout.LayoutParams
  38. (TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT);
  39.  
  40.  
  41. tableRowParams.setMargins(10, 10, 10, 10);
  42.  
  43. tr.setLayoutParams(tableRowParams);
Add Comment
Please, Sign In to add comment