本项目是一个模仿暴风影音的UI项目源码,仿照的界面有菜单页,主页,分类页等,项目内的所有数据都使用的本地模拟数据,仿照度一般在大分辨设备上布局显示会有问题,480x800的分辨率应该正合适,默认编译版本4.2.2编码GBK,注释不多,需要的朋友可以下载看一下。

×××:

http://code.662p.com/view/8949.html

publicclassMainActivityextendsTabActivity{privateSlideMenuslideMenu;privateTabHosttabHost;privateLayoutInflaterinflater;privateIntentintent1,intent2,intent3,intent4,intent5,intent6;privatelongexitTime=0;privatestaticfinalintSWIPE_MIN_DISTANCE=120;privatestaticfinalintSWIPE_MAX_OFF_PATH=250;privatestaticfinalintSWIPE_THRESHOLD_VELOCITY=200;privateGestureDetectorgestureDetector;View.OnTouchListenergestureListener;intcurrentView=0;privatestaticintmaxTabIndex=5;@OverridepublicbooleanonKeyDown(intkeyCode,KeyEventevent){if(keyCode==KeyEvent.KEYCODE_BACK&&event.getAction()==KeyEvent.ACTION_DOWN){if((System.currentTimeMillis()-exitTime)>2000){Toast.makeText(MainActivity.this,"再按一次退出程序",Toast.LENGTH_SHORT).show();exitTime=System.currentTimeMillis();}else{finish();System.exit(0);}returntrue;}returnsuper.onKeyDown(keyCode,event);}@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.main);gestureDetector=newGestureDetector(newMyGestureDetector());gestureListener=newView.OnTouchListener(){publicbooleanonTouch(Viewv,MotionEventevent){if(gestureDetector.onTouchEvent(event)){returntrue;}returnfalse;}};//抽屉效果slideMenu=(SlideMenu)findViewById(R.id.slide_menu);ImageViewmenuImg=(ImageView)findViewById(R.id.slide_firstmenu);menuImg.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewarg0){//TODOAuto-generatedmethodstubif(slideMenu.isMainScreenShowing()){slideMenu.openMenu();}else{slideMenu.closeMenu();}}});intent1=newIntent(MainActivity.this,FirstActivity.class);intent2=newIntent(MainActivity.this,SecondActivity.class);intent3=newIntent(MainActivity.this,SecondActivity.class);intent4=newIntent(MainActivity.this,SecondActivity.class);intent5=newIntent(MainActivity.this,SecondActivity.class);intent6=newIntent(MainActivity.this,MoreInformationActivity.class);LayoutInflaterinflater=LayoutInflater.from(MainActivity.this);Viewview1=inflater.inflate(R.layout.tabitem_1,null);Viewview2=inflater.inflate(R.layout.tabitem_2,null);Viewview3=inflater.inflate(R.layout.tabitem_3,null);Viewview4=inflater.inflate(R.layout.tabitem_4,null);Viewview5=inflater.inflate(R.layout.tabitem_5,null);Viewview6=inflater.inflate(R.layout.tabitem_6,null);//创建TabHost//tabHost=(TabHost)findViewById(R.id.tabHost);//tabHost.setup();tabHost=getTabHost();TabSpectabSpec1=tabHost.newTabSpec("tab1").setIndicator(view1).setContent(intent1);tabHost.addTab(tabSpec1);TabSpectabSpec2=tabHost.newTabSpec("tab2").setIndicator(view2).setContent(intent2);tabHost.addTab(tabSpec2);TabSpectabSpec3=tabHost.newTabSpec("tab3").setIndicator(view3).setContent(intent3);tabHost.addTab(tabSpec3);TabSpectabSpec4=tabHost.newTabSpec("tab4").setIndicator(view4).setContent(intent4);tabHost.addTab(tabSpec4);TabSpectabSpec5=tabHost.newTabSpec("tab5").setIndicator(view5).setContent(intent5);tabHost.addTab(tabSpec5);TabSpectabSpec6=tabHost.newTabSpec("tab6").setIndicator(view6).setContent(intent6);tabHost.addTab(tabSpec6);Buttonp_w_picpathButton1=(Button)findViewById(R.id.p_w_picpathButton1);p_w_picpathButton1.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewarg0){//TODOAuto-generatedmethodstub//Toast.makeText(MainActivity.this,"123",Toast.LENGTH_SHORT)//.show();IntentnewIntent=newIntent(MainActivity.this,LocalActivity.class);startActivity(newIntent);}});ImageViewslide_menu_history=(ImageView)findViewById(R.id.slide_menu_history);slide_menu_history.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewarg0){//TODOAuto-generatedmethodstubIntentnewIntent=newIntent(MainActivity.this,HistoryActivity.class);startActivity(newIntent);}});ImageViewslide_menu_search=(ImageView)findViewById(R.id.slide_menu_search);slide_menu_search.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubIntentnewIntent=newIntent(MainActivity.this,SearchActivity.class);startActivity(newIntent);}});}//左右滑动刚好页面也有滑动效果classMyGestureDetectorextendsSimpleOnGestureListener{@OverridepublicbooleanonFling(MotionEvente1,MotionEvente2,floatvelocityX,floatvelocityY){TabHosttabHost=getTabHost();System.out.println("************");try{if(Math.abs(e1.getY()-e2.getY())>SWIPE_MAX_OFF_PATH)returnfalse;//righttoleftswipeif(e1.getX()-e2.getX()>SWIPE_MIN_DISTANCE&&Math.abs(velocityX)>SWIPE_THRESHOLD_VELOCITY){Log.i("test","right");if(currentView==maxTabIndex){currentView=0;}else{currentView++;}tabHost.setCurrentTab(currentView);}elseif(e2.getX()-e1.getX()>SWIPE_MIN_DISTANCE&&Math.abs(velocityX)>SWIPE_THRESHOLD_VELOCITY){Log.i("test","left");if(currentView==0){currentView=maxTabIndex;}else{currentView--;}tabHost.setCurrentTab(currentView);}}catch(Exceptione){}returnfalse;}}@OverridepublicbooleandispatchTouchEvent(MotionEventevent){if(gestureDetector.onTouchEvent(event)){event.setAction(MotionEvent.ACTION_CANCEL);}returnsuper.dispatchTouchEvent(event);}@OverridepublicbooleanonTouchEvent(MotionEventevent){//TODOAuto-generatedmethodstubreturngestureDetector.onTouchEvent(event);}//@Override//publicbooleanonCreateOptionsMenu(Menumenu){//getMenuInflater().inflate(R.menu.activity_main,menu);//returntrue;//}}

  

<ignore_js_op>

运行截图推荐界面

<ignore_js_op>

导航板块

<ignore_js_op>

搜索框

<ignore_js_op>

电视剧显示

详细说明:http://android.662p.com/thread-5865-1-1.html