activity_main.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:tools="http://schemas.android.com/tools"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:orientation="vertical"
  7. tools:context=".MainActivity">
  8. <RelativeLayout
  9. android:layout_width="match_parent"
  10. android:layout_height="0dp"
  11. android:layout_weight="1.2"
  12. android:background="@color/holo_blue_light"
  13. >
  14. <LinearLayout
  15. android:layout_width="wrap_content"
  16. android:layout_height="wrap_content"
  17. android:background="@color/white"
  18. android:id="@+id/logview"
  19. android:layout_marginTop="10dp"
  20. android:layout_marginStart="0dp"
  21. >
  22. <TextView
  23. android:layout_width="match_parent"
  24. android:layout_height="match_parent"
  25. android:layout_marginStart="10dp"
  26. android:layout_marginEnd="10dp"
  27. android:layout_marginTop="5dp"
  28. android:layout_marginBottom="5dp"
  29. android:textColor="@color/black"
  30. android:textSize="30sp"
  31. android:text="日志">
  32. </TextView>
  33. </LinearLayout>
  34. <RelativeLayout
  35. android:layout_width="match_parent"
  36. android:layout_height="match_parent"
  37. android:layout_marginStart="100dp"
  38. android:layout_marginEnd="100dp"
  39. android:layout_marginTop="60dp"
  40. android:layout_marginBottom="30dp"
  41. android:gravity="center"
  42. >
  43. <RelativeLayout
  44. android:id="@+id/logLayout"
  45. android:layout_width="match_parent"
  46. android:layout_height="match_parent"
  47. android:fadeScrollbars="false"
  48. android:scrollbars="vertical"
  49. android:gravity="center"
  50. android:textColor="#000000"
  51. android:textSize="80sp"
  52. android:background="@drawable/bg_account_shape">
  53. <ListView
  54. android:id="@+id/listLog"
  55. android:layout_width="match_parent"
  56. android:layout_height="match_parent"
  57. android:stackFromBottom="false"
  58. android:transcriptMode="alwaysScroll"
  59. android:visibility="invisible"
  60. >
  61. </ListView>
  62. </RelativeLayout>
  63. </RelativeLayout>
  64. </RelativeLayout>
  65. <RelativeLayout
  66. android:layout_width="match_parent"
  67. android:background="@color/holo_blue_light"
  68. android:layout_weight="1"
  69. android:layout_height="0dp"
  70. >
  71. <LinearLayout
  72. android:id="@+id/controlView"
  73. android:layout_width="wrap_content"
  74. android:layout_height="wrap_content"
  75. android:background="@color/white"
  76. android:layout_marginTop="10dp"
  77. android:layout_marginStart="0dp"
  78. >
  79. <TextView
  80. android:layout_width="wrap_content"
  81. android:layout_height="wrap_content"
  82. android:layout_marginStart="10dp"
  83. android:layout_marginEnd="10dp"
  84. android:layout_marginTop="5dp"
  85. android:layout_marginBottom="5dp"
  86. android:textSize="30sp"
  87. android:textColor="@color/black"
  88. android:text="控制"
  89. >
  90. </TextView>
  91. </LinearLayout>
  92. <RelativeLayout
  93. android:layout_width="wrap_content"
  94. android:layout_height="wrap_content"
  95. android:layout_below="@+id/controlView"
  96. android:layout_marginTop="40dp"
  97. >
  98. <TextView
  99. android:id="@+id/tempText"
  100. android:layout_width="wrap_content"
  101. android:layout_height="wrap_content"
  102. android:layout_marginStart="0dp"
  103. android:textColor="@color/black"
  104. android:textSize="30sp"
  105. android:text="温度:">
  106. </TextView>
  107. <TextView
  108. android:id="@+id/temp"
  109. android:layout_width="wrap_content"
  110. android:layout_height="wrap_content"
  111. android:layout_toEndOf="@+id/tempText"
  112. android:layout_marginStart="10dp"
  113. android:textColor="@color/black"
  114. android:textSize="30sp"
  115. android:text="0.0"/>
  116. </RelativeLayout>
  117. <RelativeLayout
  118. android:layout_width="match_parent"
  119. android:layout_height="match_parent"
  120. android:gravity="center"
  121. >
  122. <RelativeLayout
  123. android:id="@+id/operate"
  124. android:layout_width="match_parent"
  125. android:layout_marginStart="150dp"
  126. android:layout_marginEnd="150dp"
  127. android:background="@drawable/bg_account_shape"
  128. android:layout_height="match_parent"
  129. android:gravity="center"
  130. android:layout_centerVertical="true">
  131. <Spinner
  132. android:id="@+id/serial"
  133. android:layout_width="150dp"
  134. android:layout_marginTop="0dp"
  135. android:layout_height="70dp"
  136. style="@style/Spinner"
  137. android:gravity="center"
  138. android:background="@drawable/bg_spin_normal"
  139. />
  140. <Spinner
  141. android:id="@+id/baute"
  142. android:gravity="center"
  143. android:layout_width="150dp"
  144. android:layout_height="70dp"
  145. android:layout_marginTop="0dp"
  146. android:layout_toEndOf="@id/serial"
  147. android:background="@drawable/bg_spin_normal"
  148. style="@style/Spinner"
  149. android:layout_marginStart="40dp" />
  150. <Button
  151. android:id="@+id/openSerial"
  152. android:background="@drawable/bg_btn_button"
  153. android:text="@string/openserial"
  154. android:layout_marginTop="0dp"
  155. android:layout_width="150dp"
  156. android:layout_height="70dp"
  157. android:layout_toEndOf="@id/baute"
  158. android:layout_marginStart="40dp"
  159. android:textSize="20sp"
  160. />
  161. <Button
  162. android:id="@+id/closeSerial"
  163. android:background="@drawable/bg_btn_button"
  164. android:text="@string/closeSerial"
  165. android:layout_marginTop="0dp"
  166. android:layout_width="150dp"
  167. android:layout_height="70dp"
  168. android:layout_toEndOf="@id/baute"
  169. android:layout_marginStart="40dp"
  170. android:visibility="invisible"
  171. android:textSize="20sp"
  172. />
  173. <Button
  174. android:id="@+id/clearLog"
  175. android:background="@drawable/bg_btn_button"
  176. android:text="@string/clearLog"
  177. android:layout_marginTop="0dp"
  178. android:layout_width="150dp"
  179. android:layout_height="70dp"
  180. android:layout_toEndOf="@id/openSerial"
  181. android:layout_marginStart="40dp"
  182. android:textSize="20sp"
  183. />
  184. <Button
  185. android:id="@+id/setAddr"
  186. android:background="@drawable/bg_btn_button"
  187. android:text="设备配置"
  188. android:layout_width="150dp"
  189. android:layout_height="70dp"
  190. android:layout_below="@+id/serial"
  191. android:layout_marginTop="40dp"
  192. android:textSize="20sp"
  193. />
  194. <Button
  195. android:id="@+id/readAddr"
  196. android:text="设备地址"
  197. android:layout_width="150dp"
  198. android:layout_height="70dp"
  199. android:layout_below="@id/setAddr"
  200. android:textSize="20sp"
  201. android:layout_marginTop="40dp"
  202. android:background="@drawable/bg_btn_button"
  203. />
  204. <Button
  205. android:id="@+id/motoTest"
  206. android:background="@drawable/bg_btn_button"
  207. android:text="电机测试"
  208. android:layout_marginTop="40dp"
  209. android:layout_width="150dp"
  210. android:layout_height="70dp"
  211. android:layout_toEndOf="@+id/readAddr"
  212. android:layout_below="@id/baute"
  213. android:textSize="20sp"
  214. android:layout_marginStart="40dp"/>
  215. <Button
  216. android:id="@+id/motoStart"
  217. android:background="@drawable/bg_btn_button"
  218. android:text="电机启动"
  219. android:layout_marginTop="40dp"
  220. android:layout_below="@+id/baute"
  221. android:layout_toEndOf="@+id/motoTest"
  222. android:layout_marginStart="40dp"
  223. android:layout_width="150dp"
  224. android:layout_height="70dp"
  225. android:textSize="20sp"
  226. />
  227. <Button
  228. android:id="@+id/querySerial"
  229. android:background="@drawable/bg_btn_button"
  230. android:text="序列号"
  231. android:layout_marginTop="40dp"
  232. android:layout_below="@+id/baute"
  233. android:layout_toEndOf="@+id/motoStart"
  234. android:layout_marginStart="40dp"
  235. android:layout_width="150dp"
  236. android:layout_height="70dp"
  237. android:textSize="20sp"
  238. />
  239. <Button
  240. android:id="@+id/queryStatus"
  241. android:background="@drawable/bg_btn_button"
  242. android:text="执行状态"
  243. android:layout_marginTop="40dp"
  244. android:layout_below="@+id/setAddr"
  245. android:layout_toEndOf="@+id/readAddr"
  246. android:layout_marginStart="40dp"
  247. android:layout_width="150dp"
  248. android:layout_height="70dp"
  249. android:textSize="20sp"
  250. />
  251. <Button
  252. android:id="@+id/controlIn"
  253. android:background="@drawable/bg_btn_button"
  254. android:text="开关量输入"
  255. android:layout_marginTop="40dp"
  256. android:layout_below="@+id/setAddr"
  257. android:layout_toEndOf="@+id/queryStatus"
  258. android:layout_marginStart="40dp"
  259. android:layout_width="150dp"
  260. android:layout_height="70dp"
  261. android:textSize="20sp"
  262. />
  263. <Button
  264. android:id="@+id/controlOut"
  265. android:background="@drawable/bg_btn_button"
  266. android:text="开关量输出"
  267. android:layout_marginTop="40dp"
  268. android:layout_below="@+id/setAddr"
  269. android:layout_toEndOf="@+id/controlIn"
  270. android:layout_marginStart="40dp"
  271. android:layout_width="150dp"
  272. android:layout_height="70dp"
  273. android:textSize="20sp"
  274. />
  275. </RelativeLayout>
  276. </RelativeLayout>
  277. </RelativeLayout>
  278. </LinearLayout>