Guest User

Untitled

a guest
Oct 19th, 2017
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. android:layout_width="100%"
  2.  
  3. <android.support.percent.PercentRelativeLayout
  4. xmlns:android="http://schemas.android.com/apk/res/android"
  5. xmlns:app="http://schemas.android.com/apk/res-auto"
  6. android:layout_width="match_parent"
  7. android:layout_height="match_parent">
  8.  
  9. <TextView
  10. android:layout_height="wrap_content"
  11. app:layout_widthPercent="35%"
  12. app:layout_heightPercent="10%"
  13. app:layout_marginLeftPercent="10%"
  14. app:layout_marginStartPercent="10%"
  15. android:text="Some text" />
  16.  
  17. <TextView
  18. android:layout_height="wrap_content"
  19. android:layout_alignParentEnd="true"
  20. android:layout_alignParentRight="true"
  21. android:padding="8dp"
  22. android:text="Another some text"
  23. app:layout_marginEndPercent="10%"
  24. app:layout_marginRightPercent="10%"
  25. app:layout_widthPercent="35%" />
  26. </android.support.percent.PercentRelativeLayout>
  27.  
  28. <android.support.percent.PercentFrameLayout
  29. xmlns:android="http://schemas.android.com/apk/res/android"
  30. xmlns:app="http://schemas.android.com/apk/res-auto"
  31. android:layout_width="match_parent"
  32. android:layout_height="match_parent">
  33. <Button
  34. android:background="#f0f0f0"
  35. app:layout_widthPercent="50%"
  36. app:layout_heightPercent="50%"
  37. app:layout_marginTopPercent="25%"
  38. app:layout_marginLeftPercent="25%" />
  39. </android.support.percent.PercentFrameLayout>
  40.  
  41. <LinearLayout
  42. android:layout_width="match_parent"
  43. android:layout_height="wrap_content"
  44. android:orientation="horizontal" >
  45.  
  46. <!-- Эта кнопка занимает 30% от всей ширины -->
  47. <Button
  48. android:layout_width="0dp"
  49. android:layout_height="wrap_content"
  50. android:layout_weight="0.3" />
  51.  
  52. <!-- Эта - 50% -->
  53. <Button
  54. android:layout_width="0dp"
  55. android:layout_height="wrap_content"
  56. android:layout_weight="0.5" />
  57.  
  58. <!-- А эта - 20% -->
  59. <Button
  60. android:layout_width="0dp"
  61. android:layout_height="wrap_content"
  62. android:layout_weight="0.2" />
  63.  
  64. </LinearLayout>
Add Comment
Please, Sign In to add comment