Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:id="@+id/frame_layout"
  7. android:layout_height="match_parent"
  8. app:layout_behavior="@string/appbar_scrolling_view_behavior"
  9. tools:context="br.com.demmy.demet.gerador.MainActivity"
  10. tools:showIn="@layout/app_bar_main">
  11.  
  12. <fragment
  13. android:id="@+id/primeiro_fragment"
  14. android:name="br.com.demmy.demet.gerador.PrimeiroFragment"
  15. android:layout_width="match_parent"
  16. android:layout_height="match_parent">
  17. </fragment>
  18. </FrameLayout>
  19.  
  20. public class PrimeiroFragment extends Fragment {
  21.  
  22. View minha_view;
  23.  
  24. @Nullable
  25. @Override
  26. public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
  27. minha_view = inflater.inflate(R.layout.tela_principal, container, false);
  28. return minha_view;
  29. }
  30.  
  31. <?xml version="1.0" encoding="utf-8"?>
  32. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  33. xmlns:app="http://schemas.android.com/apk/res-auto"
  34. xmlns:tools="http://schemas.android.com/tools"
  35. android:layout_width="match_parent"
  36. android:id="@+id/frame_layout"
  37. android:layout_height="match_parent"
  38. app:layout_behavior="@string/appbar_scrolling_view_behavior"
  39. tools:context="br.com.demmy.demet.gerador.MainActivity"
  40. tools:showIn="@layout/app_bar_main">
  41.  
  42. <LinearLayout
  43. android:id="@+id/linear_layout"
  44. android:orientation="vertical"
  45. android:layout_width="match_parent"
  46. android:layout_height="match_parent"
  47. android:layout_alignParentTop="true"
  48. android:layout_alignParentLeft="true"
  49. android:layout_alignParentStart="true">
  50.  
  51. <TextView
  52. android:id="@+id/textView_hora"
  53. android:layout_width="wrap_content"
  54. android:layout_height="wrap_content"
  55. android:layout_gravity="center"
  56. android:layout_marginTop="10dp"
  57. android:textSize="18sp"
  58. android:text="texto1" />
  59.  
  60. <EditText
  61. android:id="@+id/editText_hora"
  62. android:layout_width="wrap_content"
  63. android:layout_height="wrap_content"
  64. android:layout_gravity="center"
  65. android:background="@drawable/oval"
  66. android:padding="8dp"
  67. android:layout_margin="8dp"
  68. android:ems="4"
  69. android:inputType="number" />
  70.  
  71. <TextView
  72. android:id="@+id/textView3"
  73. android:layout_gravity="center"
  74. android:textSize="18sp"
  75. android:layout_marginTop="3dp"
  76. android:layout_marginBottom="5dp"
  77. android:layout_width="wrap_content"
  78. android:layout_height="wrap_content"
  79. android:text="Texto 2" />
  80.  
  81. <EditText
  82. android:id="@+id/texto_notification"
  83. android:padding="14dp"
  84. android:gravity="start"
  85. android:layout_width="match_parent"
  86. android:layout_height="0dp"
  87. android:layout_margin="8dp"
  88. android:layout_weight="1"
  89. android:background="@drawable/oval"
  90. android:inputType="textMultiLine" />
  91. <Button
  92. android:id="@+id/button"
  93. style="@style/estilo_botao"
  94. android:layout_gravity="center"
  95. android:layout_width="wrap_content"
  96. android:layout_height="wrap_content"
  97. android:layout_centerHorizontal="true"
  98. android:layout_alignParentBottom="true"
  99. android:text="Cadastrar" />
  100. </LinearLayout>
  101. </FrameLayout>
  102.  
  103. public class SegundoFragment extends Fragment {
  104.  
  105. View minha_view;
  106.  
  107. @Nullable
  108. @Override
  109. public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
  110. minha_view = inflater.inflate(R.layout.segundo_layout, container, false);
  111. return minha_view;
  112. }
  113.  
  114. <?xml version="1.0" encoding="utf-8"?>
  115. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  116. android:layout_width="match_parent" android:layout_height="match_parent">
  117.  
  118. <TextView
  119. android:id="@+id/textView2"
  120. android:layout_width="wrap_content"
  121. android:layout_height="wrap_content"
  122. android:layout_alignParentLeft="true"
  123. android:layout_alignParentStart="true"
  124. android:layout_alignParentTop="true"
  125. android:layout_marginLeft="138dp"
  126. android:layout_marginStart="138dp"
  127. android:layout_marginTop="196dp"
  128. android:text="SEGUNDO LAYOUT" />
  129.  
  130. <Button
  131. android:id="@+id/button2"
  132. android:layout_width="wrap_content"
  133. android:layout_height="wrap_content"
  134. android:layout_alignParentLeft="true"
  135. android:layout_alignParentStart="true"
  136. android:layout_alignTop="@+id/textView2"
  137. android:layout_marginLeft="68dp"
  138. android:layout_marginStart="68dp"
  139. android:text="Button" />
  140.  
  141. <Button
  142. android:id="@+id/button3"
  143. android:layout_width="wrap_content"
  144. android:layout_height="wrap_content"
  145. android:layout_alignEnd="@+id/textView2"
  146. android:layout_alignRight="@+id/textView2"
  147. android:layout_below="@+id/button2"
  148. android:layout_marginTop="16dp"
  149. android:text="Button" />
  150.  
  151. <Button
  152. android:id="@+id/button4"
  153. android:layout_width="wrap_content"
  154. android:layout_height="wrap_content"
  155. android:layout_alignLeft="@+id/button3"
  156. android:layout_alignParentTop="true"
  157. android:layout_alignStart="@+id/button3"
  158. android:layout_marginLeft="17dp"
  159. android:layout_marginStart="17dp"
  160. android:layout_marginTop="60dp"
  161. android:text="Button" />
  162.  
  163. <Button
  164. android:id="@+id/button5"
  165. android:layout_width="wrap_content"
  166. android:layout_height="wrap_content"
  167. android:layout_alignParentEnd="true"
  168. android:layout_alignParentRight="true"
  169. android:layout_alignTop="@+id/textView2"
  170. android:text="Button" />
  171. </RelativeLayout>
  172.  
  173. lista_drawer.setOnItemClickListener(new AdapterView.OnItemClickListener(){
  174.  
  175. @Override
  176. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  177. android.app.FragmentManager fragmentManager = getFragmentManager();
  178. if (position == 0){
  179. fragmentManager.beginTransaction().replace(R.id.frame_layout, new PrimeiroFragment()).commit();
  180. }else if(position == 1){
  181. fragmentManager.beginTransaction().replace(R.id.frame_layout, new SegundoFragment()).commit();
  182. }else if(position == 2){
  183. fragmentManager.beginTransaction().replace(R.id.frame_layout, new TerceiroFragment()).commit();
  184. }
  185. }
  186. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement