本人写的一个广州恒大亚冠宣传软件,截图软件差劲,见谅。。
关于:
球员画廊:
宣传片:滂湃
官网:
程序代码:
欢迎下载应用、、
1 package com.xmb.androidgallery; 2 3 import java.security.PublicKey; 4 5 import javax.security.auth.PrivateCredentialPermission; 6 7 8 9 10 import android.R.integer; 11 import android.net.Uri; 12 import android.os.Bundle; 13 import android.provider.MediaStore.MediaColumns; 14 import android.provider.MediaStore.Video; 15 import android.annotation.SuppressLint; 16 import android.app.Activity; 17 import android.app.AlertDialog; 18 import android.app.AlertDialog.Builder; 19 import android.app.Dialog; 20 import android.content.Context; 21 import android.content.DialogInterface; 22 import android.content.Intent; 23 import android.graphics.Paint; 24 import android.view.Menu; 25 import android.view.MenuItem; 26 import android.view.MenuItem.OnMenuItemClickListener; 27 import android.view.View; 28 import android.view.ViewGroup; 29 import android.view.View.OnClickListener; 30 import android.widget.AdapterView; 31 import android.widget.BaseAdapter; 32 import android.widget.Button; 33 import android.widget.Gallery; 34 import android.widget.ImageView; 35 import android.widget.MediaController; 36 import android.widget.Toast; 37 import android.widget.VideoView; 38 import android.support.v4.app.NavUtils; 39 40 41 42 //@SuppressLint({ "ParserError", "ParserError", "ParserError" }) 43 public class MainActivity extends Activity { 44 45 @Override 46 public void onCreate(Bundle savedInstanceState) { 47 super.onCreate(savedInstanceState); 48 setContentView(R.layout.activity_main); 49 Button bt2=(Button)findViewById(R.id.bt2); 50 Button bt1=(Button)findViewById(R.id.bt1); 51 52 final VideoView videoView=(VideoView)findViewById(R.id.vi); 53 MediaController mc=new MediaController(this); 54 mc.setAnchorView(videoView); 55 videoView.setMediaController(mc); 56 videoView.setVideoPath("/sdcard/gz.mp4"); 57 bt2.setOnClickListener(new OnClickListener() 58 { 59 60 @Override 61 public void onClick(View v) 62 { 63 videoView.start(); 64 65 } 66 }); 67 68 bt1.setOnClickListener(new OnClickListener() 69 { 70 71 @Override 72 public void onClick(View arg0) 73 { 74 Uri uri=Uri.parse("http://www.gzevergrandefc.com//"); 75 Intent intent=new Intent(Intent.ACTION_VIEW,uri); 76 startActivity(intent); 77 } 78 }); 79 80 81 82 83 final int[] images={R.drawable.h,R.drawable.b,R.drawable.f,R.drawable.g,R.drawable.j,R.drawable.jn,R.drawable.k,R.drawable.kla,R.drawable.m,R.drawable.s,R.drawable.y,R.drawable.z,R.drawable.zlp,R.drawable.zz,R.drawable.fjy,R.drawable.qs,R.drawable.bl,R.drawable.ls}; 84 final Gallery g1=(Gallery)findViewById(R.id.gallery); 85 BaseAdapter adapter=new BaseAdapter() 86 87 { 88 89 @Override 90 public View getView(int position, View converView, ViewGroup parent) 91 { 92 ImageView iV=new ImageView(MainActivity.this); 93 iV.setImageResource(images[position]); 94 iV.setScaleType(ImageView.ScaleType.FIT_XY); 95 iV.setLayoutParams(new Gallery.LayoutParams(170,220)); 96 return iV; 97 } 98 99 @Override 100 public long getItemId(int arg0) 101 { 102 // TODO Auto-generated method stub 103 return 0; 104 } 105 106 @Override 107 public Object getItem(int arg0) 108 { 109 // TODO Auto-generated method stub 110 return null; 111 } 112 113 @Override 114 public int getCount() 115 { 116 // TODO Auto-generated method stub 117 return images.length; 118 } 119 }; 120 g1.setSpacing(10); 121 g1.setAdapter(adapter); 122 g1.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() 123 { 124 125 @Override 126 public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) 127 { 128 String t =null; 129 130 switch (arg2) 131 { 132 case 1: 133 t="18-巴里奥斯"; 134 break; 135 case 2: 136 t="6-冯潇霆"; 137 break; 138 case 3: 139 t="29-郜林"; 140 break; 141 case 4: 142 t="28-金英权"; 143 break; 144 case 5: 145 t="21-姜宁"; 146 break; 147 case 6: 148 t="15-孔卡"; 149 break; 150 case 7: 151 t="9-克莱奥"; 152 break; 153 case 8: 154 t="11-穆里奇"; 155 break; 156 case 9: 157 t="32-孙祥"; 158 break; 159 case 10: 160 t="1-杨君"; 161 break; 162 case 11: 163 t="37-赵旭日"; 164 break; 165 case 12: 166 t="5-张琳芃"; 167 break; 168 case 13: 169 t="10-郑智"; 170 break; 171 case 14: 172 t="7-冯俊彦"; 173 break; 174 case 15: 175 t="8-秦升"; 176 break; 177 case 16: 178 t="3-保隆"; 179 break; 180 case 17: 181 t="22-李帅"; 182 break; 183 184 default: 185 t="广州恒大"; 186 break; 187 } 188 Toast.makeText(getApplicationContext(), t,Toast.LENGTH_LONG).show(); 189 return false; 190 } 191 }); 192 193 194 } 195 196 //创建Menu菜单 197 public boolean onCreateOptionsMenu(Menu menu) { 198 menu.add(0, 1, 0, "关于版权").setIcon(R.drawable.ic_action_search); //设置文字与图标 199 menu.add(0, 2, 0, "退出"); 200 201 return super.onCreateOptionsMenu(menu); 202 } 203 204 //点击Menu菜单选项响应事件 205 public boolean onOptionsItemSelected(MenuItem item) { 206 switch(item.getItemId()){ 207 case 1: 208 showDialog(1); 209 break; 210 case 2: 211 Toast.makeText(this, "你退出了广州恒大应用程序", Toast.LENGTH_SHORT).show(); 212 finish(); 213 break; 214 } 215 return super.onOptionsItemSelected(item); 216 } 217 218 //选项菜单被关闭事件,菜单被关闭有三种情形,menu按钮被再次点击、 219 //back按钮被点击或者用户选择了某一个菜单项 220 public void onOptionsMenuClosed(Menu menu) { 221 222 } 223 224 //菜单被显示之前的事件 225 public boolean onPrepareOptionsMenu(Menu menu) { 226 //Toast.makeText(this, 227 // "选项菜单显示之前onPrepareOptionsMenu方法会被调用",Toast.LENGTH_LONG).show(); 228 //如果返回false,此方法就把用户点击menu的动作给消费了, 229 //onCreateOptionsMenu方法将不会被调用 230 return true; 231 } 232 233 protected Dialog onCreateDialog(int id) 234 { 235 Dialog dialog=null; 236 switch (id) 237 { 238 case 1: 239 Builder builder=new AlertDialog.Builder(this); 240 builder.setTitle("关于"); 241 builder.setMessage("冼敏兵版权所有,冒仿必究!"); 242 builder.setIcon(R.drawable.qq_head); 243 builder.setPositiveButton("确定", new DialogInterface.OnClickListener() 244 { 245 246 @Override 247 public void onClick(DialogInterface arg0, int arg1) 248 { 249 // TODO Auto-generated method stub 250 251 } 252 }); 253 dialog=builder.create(); 254 break; 255 256 default: 257 break; 258 } 259 return dialog; 260 } 261 { 262 263 } 264 }
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 android:orientation="vertical" 3 android:layout_width="fill_parent" 4 android:layout_height="fill_parent" > 5 6 <Gallery android:layout_width="match_parent" 7 android:id="@+id/gallery" 8 9 android:layout_height="wrap_content" 10 android:gravity="center_vertical" 11 android:spacing="16dp" 12 13 14 /> 15 <TableLayout 16 android:layout_width="match_parent" 17 android:layout_height="fill_parent" 18 19 > 20 <TableRow> 21 22 <Button 23 android:id="@+id/bt1" 24 android:layout_width="wrap_content" 25 android:layout_height="wrap_content" 26 android:text="点击进入官方网站" 27 /> 28 <Button 29 android:id="@+id/bt2" 30 android:layout_width="wrap_content" 31 android:layout_height="wrap_content" 32 android:text="让世界听见广州的声音!" 33 /> 34 </TableRow> 35 36 <VideoView 37 android:id="@+id/vi" 38 android:layout_width="match_parent" 39 android:layout_height="wrap_content" 40 /> 41 42 </TableLayout> 43 </LinearLayout>
注意补充清单中的网络连接允许、