歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android之收音機UI實現

Android之收音機UI實現

日期:2017/3/1 10:06:26   编辑:Linux編程

最近在研究收音機的源碼,本來想把收音機從源碼中提取出來,做成一個單獨的應用,但是,收音機需要底層的支持,所以,就有點無能為力了,不過發現UI做得比較有個性(如下圖所示),圖片比較丑(這是做圖片MM的責任哦,哈哈),就單獨拿出來跟大家分享一下,順便自己也學習一下自定義view。

代碼下載:

免費下載地址在 http://linux.linuxidc.com/

用戶名與密碼都是www.linuxidc.com

具體下載目錄在 /2012年資料/11月/26日/Android之收音機UI實現

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:background="@drawable/background_main"
  6. android:orientation="vertical" >
  7. <RelativeLayout
  8. android:layout_width="320dip"
  9. android:layout_height="113dip"
  10. android:layout_x="0dip"
  11. android:layout_y="180dip"
  12. android:background="@drawable/led_disabled" />
  13. <RelativeLayout
  14. android:id="@+id/led_background"
  15. android:layout_width="320dip"
  16. android:layout_height="113dip"
  17. android:layout_x="0dip"
  18. android:layout_y="180dip"
  19. android:background="@drawable/led_enabled" >
  20. <ImageView
  21. android:id="@+id/fm_indicator"
  22. android:layout_width="wrap_content"
  23. android:layout_height="wrap_content"
  24. android:layout_alignParentLeft="true"
  25. android:layout_alignParentTop="true"
  26. android:layout_marginLeft="14dip"
  27. android:layout_marginTop="12dip"
  28. android:src="@drawable/fm" />
  29. <ImageView
  30. android:id="@+id/headset_indicator"
  31. android:layout_width="wrap_content"
  32. android:layout_height="wrap_content"
  33. android:layout_marginTop="12dip"
  34. android:layout_toRightOf="@id/fm_indicator"
  35. android:src="@drawable/headset_indicator" />
  36. <TextView
  37. android:id="@+id/text_hour_type"
  38. android:layout_width="wrap_content"
  39. android:layout_height="wrap_content"
  40. android:layout_alignParentRight="true"
  41. android:layout_alignParentTop="true"
  42. android:layout_marginRight="13dip"
  43. android:layout_marginTop="10dip"
  44. android:textColor="#000000" />
  45. <com.way.view.DigitalTextView
  46. android:id="@+id/digital_clock"
  47. android:layout_width="wrap_content"
  48. android:layout_height="wrap_content"
  49. android:layout_alignParentTop="true"
  50. android:layout_marginTop="13dip"
  51. android:layout_toLeftOf="@+id/text_hour_type" />
  52. <ImageView
  53. android:id="@+id/searching_indicator"
  54. android:layout_width="wrap_content"
  55. android:layout_height="wrap_content"
  56. android:layout_marginTop="13dip"
  57. android:layout_toLeftOf="@id/digital_clock"
  58. android:src="@drawable/searching" />
  59. <com.way.view.DigitalTextView
  60. android:id="@+id/digital_freq"
  61. android:layout_width="wrap_content"
  62. android:layout_height="wrap_content"
  63. android:layout_alignParentRight="true"
  64. android:layout_alignParentTop="true"
  65. android:layout_marginRight="84dip"
  66. android:layout_marginTop="15dip" />
  67. <SeekBar
  68. android:id="@+id/freq_indicator"
  69. android:layout_width="fill_parent"
  70. android:layout_height="wrap_content"
  71. android:layout_alignParentBottom="true"
  72. android:layout_marginBottom="12dip"
  73. android:layout_marginLeft="7dip"
  74. android:layout_marginRight="7dip"
  75. android:progressDrawable="@drawable/blank"
  76. android:thumb="@drawable/pointer"
  77. android:thumbOffset="0dip" />
  78. </RelativeLayout>
  79. <FrameLayout
  80. android:layout_width="220dip"
  81. android:layout_height="30dip"
  82. android:layout_x="50dip"
  83. android:layout_y="291dip"
  84. android:background="@drawable/scroller_bg" >
  85. <com.way.view.TuneWheel
  86. android:id="@+id/tune_wheel"
  87. android:layout_width="fill_parent"
  88. android:layout_height="fill_parent" />
  89. <ImageView
  90. android:layout_width="fill_parent"
  91. android:layout_height="fill_parent"
  92. android:src="@drawable/tune_wheel_highlight" />
  93. </FrameLayout>
  94. <ImageButton
  95. android:id="@+id/add_button"
  96. android:layout_width="wrap_content"
  97. android:layout_height="wrap_content"
  98. android:layout_x="39dip"
  99. android:layout_y="332dip"
  100. android:background="#00000000"
  101. android:src="@drawable/add_button" />
  102. <ImageButton
  103. android:id="@+id/prev_station_button"
  104. android:layout_width="wrap_content"
  105. android:layout_height="wrap_content"
  106. android:layout_x="108dip"
  107. android:layout_y="332dip"
  108. android:background="#00000000"
  109. android:src="@drawable/prev_station_button" />
  110. <ImageButton
  111. android:id="@+id/search_prev_button"
  112. android:layout_width="wrap_content"
  113. android:layout_height="wrap_content"
  114. android:layout_x="176dip"
  115. android:layout_y="332dip"
  116. android:background="#00000000"
  117. android:src="@drawable/search_prev_button" />
  118. <com.way.view.CheckableImageButton
  119. android:id="@+id/headset_toggle"
  120. android:layout_width="wrap_content"
  121. android:layout_height="wrap_content"
  122. android:layout_x="255dip"
  123. android:layout_y="332dip"
  124. android:background="#00000000" />
  125. <com.way.view.CheckableImageButton
  126. android:id="@+id/power_toggle"
  127. android:layout_width="wrap_content"
  128. android:layout_height="wrap_content"
  129. android:layout_x="0dip"
  130. android:layout_y="403dip"
  131. android:background="#00000000" />
  132. <ImageButton
  133. android:id="@+id/radio_list_button"
  134. android:layout_width="wrap_content"
  135. android:layout_height="wrap_content"
  136. android:layout_x="80dip"
  137. android:layout_y="402dip"
  138. android:background="#00000000"
  139. android:src="@drawable/radio_list_button" />
  140. <ImageButton
  141. android:id="@+id/next_station_button"
  142. android:layout_width="wrap_content"
  143. android:layout_height="wrap_content"
  144. android:layout_x="146dip"
  145. android:layout_y="404dip"
  146. android:background="#00000000"
  147. android:src="@drawable/next_station_button" />
  148. <ImageButton
  149. android:id="@+id/search_next_button"
  150. android:layout_width="wrap_content"
  151. android:layout_height="wrap_content"
  152. android:layout_x="215dip"
  153. android:layout_y="402dip"
  154. android:background="#00000000"
  155. android:src="@drawable/search_next_button" />
  156. </AbsoluteLayout>
Copyright © Linux教程網 All Rights Reserved