Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. <RelativeLayout android:id="@+id/mainContent" android:layout_width="fill_parent" android:layout_height="fill_parent"
  2. android:orientation="horizontal" android:background="#ffffff">
  3. <ImageView
  4. android:id="@+id/img_effect+camera"
  5. android:layout_width="fill_parent"
  6. android:layout_height="wrap_content"
  7. android:layout_alignParentLeft="true"
  8. android:src="@drawable/a" />
  9. <ImageView
  10. android:id="@+id/img_collage"
  11. android:layout_width="fill_parent"
  12. android:layout_height="wrap_content"
  13. android:layout_alignParentLeft="true"
  14. android:layout_below="@+id/img_effect+camera"
  15. android:src="@drawable/b" />
  16. <ImageView
  17. android:id="@+id/img_draw"
  18. android:layout_width="fill_parent"
  19. android:layout_height="wrap_content"
  20. android:layout_alignParentRight="true"
  21. android:layout_below="@+id/img_effect+camera"
  22. android:layout_toRightOf="@+id/img_collage"
  23. android:src="@drawable/c" />
  24. <ImageView
  25. android:id="@+id/img_photo"
  26. android:layout_width="fill_parent"
  27. android:layout_height="wrap_content"
  28. android:layout_alignParentRight="true"
  29. android:layout_toRightOf="@+id/img_collage"
  30. android:layout_below="@+id/img_draw"
  31. android:src="@drawable/d" />
  32. <ImageView
  33. android:id="@+id/img_shop"
  34. android:layout_width="fill_parent"
  35. android:layout_height="wrap_content"
  36. android:layout_alignParentLeft="true"
  37. android:layout_below="@+id/img_photo"
  38. android:src="@drawable/e" />
  39. </RelativeLayout>
  40.  
  41. <LinearLayout android:id="@+id/mainContent" android:layout_width="match_parent" android:layout_height="match_parent"
  42. android:orientation="vertical" android:background="#ffffff">
  43. <!-- height 25% -->
  44. <LinearLayout
  45. android:layout_width="match_parent"
  46. android:layout_height="0dp"
  47. android:layout_weight="1"
  48. android:orientation="horizontal">
  49.  
  50. <ImageView
  51. android:id="@+id/img_effect"
  52. android:layout_width="0dp"
  53. android:layout_height="match_parent"
  54. android:layout_weight="1"
  55. android:src="@drawable/a" />
  56. <ImageView
  57. android:id="@+id/img_camera"
  58. android:layout_width="0dp"
  59. android:layout_height="match_parent"
  60. android:layout_weight="1"
  61. android:src="@drawable/a" />
  62. </LinearLayout>
  63.  
  64. <!-- height 50% -->
  65. <LinearLayout
  66. android:layout_width="match_parent"
  67. android:layout_height="0dp"
  68. android:layout_weight="2"
  69. android:orientation="horizontal">
  70.  
  71. <!-- width 50% -->
  72.  
  73. <LinearLayout
  74. android:layout_width="0dp"
  75. android:layout_height="match_parent"
  76. android:layout_weight="1"
  77. android:orientation="vertical">
  78.  
  79. <!-- height 50%% -->
  80. <ImageView
  81. android:id="@+id/img_collage"
  82. android:layout_width="match_parent"
  83. android:layout_height="0dp"
  84. android:layout_weight="1"
  85. android:src="@drawable/a" />
  86.  
  87. <!-- height 50%% -->
  88. <ImageView
  89. android:id="@+id/img_draw"
  90. android:layout_width="match_parent"
  91. android:layout_height="0dp"
  92. android:layout_weight="1"
  93. android:src="@drawable/a" />
  94. </LinearLayout>
  95.  
  96. <!-- width 50% -->
  97. <ImageView
  98. android:id="@+id/img_photo"
  99. android:layout_width="0dp"
  100. android:layout_weight="1"
  101. android:layout_height="match_parent"
  102. android:src="@drawable/b" />
  103. </LinearLayout>
  104. <!-- height 25%% -->
  105. <ImageView
  106. android:id="@+id/img_shop"
  107. android:layout_width="match_parent"
  108. android:layout_height="0dp"
  109. android:layout_weight="1"
  110. android:src="@drawable/e" />
  111.  
  112. final View parentView= findViewById(R.id.mainContent);
  113. final ImageView effect_camera= (ImageView)findViewById(R.id.img_effect+camera);
  114.  
  115. effect_camera.post(new Runnable(){
  116. int height=parentView.getHeight();
  117. int width=parentView.getWidth();
  118.  
  119.  
  120. RelativeLayout.LayoutParams lp= (RelativeLayout.LayoutParams)effect_camera.getLayoutParams();
  121. int percentHeight=height*.25;
  122. int percentWidth= width*1;
  123. lp.height=percentHeight;
  124. lp.width=percentWidth;
  125. effect_camera.setLayoutParams(lp);
  126. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement