Guest User

Untitled

a guest
Mar 21st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. -----------------------------------
  2. | |
  3. | A B |
  4. | |
  5. -----------------------------------
  6.  
  7. -----------------------------------
  8. | |
  9. | AB |
  10. | |
  11. -----------------------------------
  12.  
  13. <LinearLayout
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content"
  16. android:oriantion="horizontal"
  17. android:weightSum="2">
  18.  
  19. <Button
  20. android:layout_width="0dp"
  21. android:layout_height="wrap_content"
  22. android:layout_weight="1"
  23. android:text="1" />
  24.  
  25. <Button
  26. android:layout_width="0dp"
  27. android:layout_height="wrap_content"
  28. android:layout_weight="1"
  29. android:text="3" />
  30.  
  31. </LinearLayout>
  32.  
  33. <LinearLayout
  34. android:layout_width="fill_parent"
  35. android:layout_height="wrap_content"
  36. android:weightSum="1"
  37. android:orientation="horizontal">
  38.  
  39. <ImageView
  40. android:id="@+id/image1"
  41. android:layout_width="0dp"
  42. android:layout_height="wrap_content"
  43. android:src="@mipmap/ic_launcher"
  44. android:layout_weight=".5" />
  45.  
  46. <ImageView
  47. android:id="@+id/image2"
  48. android:layout_width="0dp"
  49. android:layout_height="wrap_content"
  50. android:src="@mipmap/ic_launcher"
  51. android:layout_weight=".5" />
  52. </LinearLayout>
  53.  
  54. <LinearLayout
  55. android:layout_width="match_parent"
  56. android:layout_height="wrap_content"
  57. android:orientation="horizontal"
  58. android:gravity="center"
  59. >
  60.  
  61. <ImageView
  62. android:layout_width="wrap_content"
  63. android:layout_height="wrap_content"
  64. android:src="@mipmap/ic_launcher"/>
  65.  
  66. <ImageView
  67. android:layout_width="wrap_content"
  68. android:layout_height="wrap_content"
  69. android:layout_marginLeft="50dp"
  70. android:src="@mipmap/ic_launcher"/>
  71.  
  72. </LinearLayout>
  73.  
  74. <LinearLayout
  75. android:layout_width="fill_parent"
  76. android:layout_height="wrap_content"
  77. android:orientation="horizontal">
  78.  
  79. <ImageView
  80. android:id="@+id/image1"
  81. android:layout_width="wrap_content"
  82. android:layout_height="wrap_content"
  83. android:layout_weight="1"
  84. />
  85.  
  86. <ImageView
  87. android:id="@+id/image2"
  88. android:layout_width="wrap_content"
  89. android:layout_height="wrap_content"
  90. android:layout_weight="1"
  91. />
  92. </LinearLayout>
  93.  
  94. <LinearLayout
  95. android:id="@+id/servicesLinearLayout"
  96. android:layout_width="match_parent"
  97. android:layout_height="wrap_content"
  98. android:gravity="center_horizontal"
  99. android:orientation="horizontal">
  100.  
  101. </LinearLayout>
  102.  
  103. LinearLayout yourLinearLayout = (LinearLayout) findViewById(R.id.yourLinearLayout);
  104.  
  105. LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
  106. LinearLayout.LayoutParams.WRAP_CONTENT,
  107. LinearLayout.LayoutParams.WRAP_CONTENT
  108. );
  109.  
  110. for (int i = 0; i < imagesToAdd.size(); i++) {
  111. ImageView imgView = new ImageView(this);
  112. imgView.setImageResource("yourResourceID" + i);
  113. imgView.setLayoutParams(layoutParams);
  114. yourLinearLayout.addView(imgView);
  115. }
Add Comment
Please, Sign In to add comment