Android之收音机UI实现


最近在研究收音机的源码,本来想把收音机从源码中提取出来,做成一个单独的应用,但是,收音机需要底层的支持,所以,就有点无能为力了,不过发现UI做得比较有个性(如下图所示),图片比较丑(这是做图片MM的责任哦,哈哈),就单独拿出来跟大家分享一下,顺便自己也学习一下自定义view。

Android之收音机UI实现

代码下载:

免费下载地址在 http://linux.bkjia.com/

用户名与密码都是www.bkjia.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.  
  8.     <RelativeLayout 
  9.         android:layout_width="320dip" 
  10.         android:layout_height="113dip" 
  11.         android:layout_x="0dip" 
  12.         android:layout_y="180dip" 
  13.         android:background="@drawable/led_disabled" /> 
  14.  
  15.     <RelativeLayout 
  16.         android:id="@+id/led_background" 
  17.         android:layout_width="320dip" 
  18.         android:layout_height="113dip" 
  19.         android:layout_x="0dip" 
  20.         android:layout_y="180dip" 
  21.         android:background="@drawable/led_enabled" > 
  22.  
  23.         <ImageView 
  24.             android:id="@+id/fm_indicator" 
  25.             android:layout_width="wrap_content" 
  26.             android:layout_height="wrap_content" 
  27.             android:layout_alignParentLeft="true" 
  28.             android:layout_alignParentTop="true" 
  29.             android:layout_marginLeft="14dip" 
  30.             android:layout_marginTop="12dip" 
  31.             android:src="@drawable/fm" /> 
  32.  
  33.         <ImageView 
  34.             android:id="@+id/headset_indicator" 
  35.             android:layout_width="wrap_content" 
  36.             android:layout_height="wrap_content" 
  37.             android:layout_marginTop="12dip" 
  38.             android:layout_toRightOf="@id/fm_indicator" 
  39.             android:src="@drawable/headset_indicator" /> 
  40.  
  41.         <TextView 
  42.             android:id="@+id/text_hour_type" 
  43.             android:layout_width="wrap_content" 
  44.             android:layout_height="wrap_content" 
  45.             android:layout_alignParentRight="true" 
  46.             android:layout_alignParentTop="true" 
  47.             android:layout_marginRight="13dip" 
  48.             android:layout_marginTop="10dip" 
  49.             android:textColor="#000000" /> 
  50.  
  51.         <com.way.view.DigitalTextView 
  52.             android:id="@+id/digital_clock" 
  53.             android:layout_width="wrap_content" 
  54.             android:layout_height="wrap_content" 
  55.             android:layout_alignParentTop="true" 
  56.             android:layout_marginTop="13dip" 
  57.             android:layout_toLeftOf="@+id/text_hour_type" /> 
  58.  
  59.         <ImageView 
  60.             android:id="@+id/searching_indicator" 
  61.             android:layout_width="wrap_content" 
  62.             android:layout_height="wrap_content" 
  63.             android:layout_marginTop="13dip" 
  64.             android:layout_toLeftOf="@id/digital_clock" 
  65.             android:src="@drawable/searching" /> 
  66.  
  67.         <com.way.view.DigitalTextView 
  68.             android:id="@+id/digital_freq" 
  69.             android:layout_width="wrap_content" 
  70.             android:layout_height="wrap_content" 
  71.             android:layout_alignParentRight="true" 
  72.             android:layout_alignParentTop="true" 
  73.             android:layout_marginRight="84dip" 
  74.             android:layout_marginTop="15dip" /> 
  75.  
  76.         <SeekBar 
  77.             android:id="@+id/freq_indicator" 
  78.             android:layout_width="fill_parent" 
  79.             android:layout_height="wrap_content" 
  80.             android:layout_alignParentBottom="true" 
  81.             android:layout_marginBottom="12dip" 
  82.             android:layout_marginLeft="7dip" 
  83.             android:layout_marginRight="7dip" 
  84.             android:progressDrawable="@drawable/blank" 
  85.             android:thumb="@drawable/pointer" 
  86.             android:thumbOffset="0dip" /> 
  87.     </RelativeLayout> 
  88.  
  89.     <FrameLayout 
  90.         android:layout_width="220dip" 
  91.         android:layout_height="30dip" 
  92.         android:layout_x="50dip" 
  93.         android:layout_y="291dip" 
  94.         android:background="@drawable/scroller_bg" > 
  95.  
  96.         <com.way.view.TuneWheel 
  97.             android:id="@+id/tune_wheel" 
  98.             android:layout_width="fill_parent" 
  99.             android:layout_height="fill_parent" /> 
  100.  
  101.         <ImageView 
  102.             android:layout_width="fill_parent" 
  103.             android:layout_height="fill_parent" 
  104.             android:src="@drawable/tune_wheel_highlight" /> 
  105.     </FrameLayout> 
  106.  
  107.     <ImageButton 
  108.         android:id="@+id/add_button" 
  109.         android:layout_width="wrap_content" 
  110.         android:layout_height="wrap_content" 
  111.         android:layout_x="39dip" 
  112.         android:layout_y="332dip" 
  113.         android:background="#00000000" 
  114.         android:src="@drawable/add_button" /> 
  115.  
  116.     <ImageButton 
  117.         android:id="@+id/prev_station_button" 
  118.         android:layout_width="wrap_content" 
  119.         android:layout_height="wrap_content" 
  120.         android:layout_x="108dip" 
  121.         android:layout_y="332dip" 
  122.         android:background="#00000000" 
  123.         android:src="@drawable/prev_station_button" /> 
  124.  
  125.     <ImageButton 
  126.         android:id="@+id/search_prev_button" 
  127.         android:layout_width="wrap_content" 
  128.         android:layout_height="wrap_content" 
  129.         android:layout_x="176dip" 
  130.         android:layout_y="332dip" 
  131.         android:background="#00000000" 
  132.         android:src="@drawable/search_prev_button" /> 
  133.  
  134.     <com.way.view.CheckableImageButton 
  135.         android:id="@+id/headset_toggle" 
  136.         android:layout_width="wrap_content" 
  137.         android:layout_height="wrap_content" 
  138.         android:layout_x="255dip" 
  139.         android:layout_y="332dip" 
  140.         android:background="#00000000" /> 
  141.  
  142.     <com.way.view.CheckableImageButton 
  143.         android:id="@+id/power_toggle" 
  144.         android:layout_width="wrap_content" 
  145.         android:layout_height="wrap_content" 
  146.         android:layout_x="0dip" 
  147.         android:layout_y="403dip" 
  148.         android:background="#00000000" /> 
  149.  
  150.     <ImageButton 
  151.         android:id="@+id/radio_list_button" 
  152.         android:layout_width="wrap_content" 
  153.         android:layout_height="wrap_content" 
  154.         android:layout_x="80dip" 
  155.         android:layout_y="402dip" 
  156.         android:background="#00000000" 
  157.         android:src="@drawable/radio_list_button" /> 
  158.  
  159.     <ImageButton 
  160.         android:id="@+id/next_station_button" 
  161.         android:layout_width="wrap_content" 
  162.         android:layout_height="wrap_content" 
  163.         android:layout_x="146dip" 
  164.         android:layout_y="404dip" 
  165.         android:background="#00000000" 
  166.         android:src="@drawable/next_station_button" /> 
  167.  
  168.     <ImageButton 
  169.         android:id="@+id/search_next_button" 
  170.         android:layout_width="wrap_content" 
  171.         android:layout_height="wrap_content" 
  172.         android:layout_x="215dip" 
  173.         android:layout_y="402dip" 
  174.         android:background="#00000000" 
  175.         android:src="@drawable/search_next_button" /> 
  176.  
  177. </AbsoluteLayout> 
  • 1
  • 2
  • 3
  • 4
  • 下一页

相关内容