Android单机版音乐盒


这个小软件主要用到了可以后台运行的Service组件、BroadcastReceiver组件、Intent、菜单对话框的使用及音乐的播放等。

布局很明了,通过三个线性布局的嵌套。

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"  
  3. android:orientation="vertical"  
  4.         android:layout_width="fill_parent"  
  5.         android:layout_height="fill_parent">  
  6. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  7.     android:orientation="horizontal"  
  8.     android:layout_width="fill_parent"  
  9.     android:layout_height="wrap_content">  
  10.     <ImageButton  
  11.         android:id="@+id/start"  
  12.         android:layout_width="wrap_content"  
  13.         android:layout_height="wrap_content"  
  14.         android:src="@drawable/png2"/>  
  15.     <ImageButton   
  16.         android:id="@+id/stop"   
  17.         android:layout_width="wrap_content"  
  18.         android:layout_height="wrap_content"  
  19.         android:src="@drawable/png1"/>  
  20.     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  21.         android:orientation="vertical"  
  22.         android:layout_width="fill_parent"  
  23.         android:layout_height="fill_parent">  
  24.         <TextView  
  25.             android:id="@+id/textView1"  
  26.             android:layout_width="wrap_content"   
  27.             android:layout_height="wrap_content"  
  28.             android:textSize="25px"  
  29.             android:textColor="#ffffff"  
  30.             android:ellipsize="marquee"//跑马灯效果   
  31.             android:layout_weight="1"  
  32.             android:marqueeRepeatLimit="marquee_forever"//跑马灯无限循环   
  33.             android:text="@string/myTextView1"/>  
  34.         <TextView  
  35.             android:id="@+id/textView2"  
  36.             android:textSize="15px"  
  37.             android:gravity="center_vertical"  
  38.             android:layout_weight="1"  
  39.             android:layout_width="wrap_content"  
  40.             android:layout_height="wrap_content"  
  41.             android:text="@string/myTextView2"/>           
  42.     </LinearLayout>  
  43. </LinearLayout>  
  44. <ImageView  
  45.             android:layout_width="wrap_content"  
  46.             android:layout_height="wrap_content"  
  47.             android:src="@drawable/jinsha"  
  48.             />  
  49. </LinearLayout>  
  • 1
  • 2
  • 3
  • 下一页

相关内容