Android高仿去哪儿酒店预定UI应用APP源代码下载
2015-12-29 13:43:07  By: dwtedx

本Demo是一个仿去哪儿安卓客户端的UI项目源码、只实现了界面部分、没有实际功能、所有数据都是在源码里写死的、不过仿的界面效果很不错、主页的块点击以后有回弹效果、顶部的图片滚动也可以使用

支持自动滚动和手动滚动、酒店搜索、酒店列表、酒店详情、房间预定等界面也都实现了仿照、还有下拉刷新、仿IOS开关等小细节功能也做的不错、有需要的朋友可以下载看一下、源码有少量注释、效果图如下

android 去哪儿源代码


首页初始化选项卡

public void initTab(){ 
    TabHost.TabSpec tSpecHome = tabHost.newTabSpec("home");
    tSpecHome.setIndicator(tabIndicator1);        
    tSpecHome.setContent(new DummyTabContent(getBaseContext()));
    tabHost.addTab(tSpecHome);
    
    TabHost.TabSpec tSpecWall = tabHost.newTabSpec("wall");
    tSpecWall.setIndicator(tabIndicator2);        
    tSpecWall.setContent(new DummyTabContent(getBaseContext()));
    tabHost.addTab(tSpecWall);
    
    TabHost.TabSpec tSpecCamera = tabHost.newTabSpec("index");
    tSpecCamera.setIndicator(tabIndicator3);        
    tSpecCamera.setContent(new DummyTabContent(getBaseContext()));
    tabHost.addTab(tSpecCamera);
    
   /* //拍照按钮监听事件,弹出dialog
    tabIndicator3.setOnClickListener(new OnClickListener() {
        @Override
       public void onClick(View v) {
            
            Dialog choose = new Dialog(MainActivity.this,R.style.draw_dialog);
            choose.setContentView(R.layout.camera_dialog);
            // 设置背景模糊参数
            WindowManager.LayoutParams winlp = choose.getWindow()
                    .getAttributes();
            winlp.alpha = 0.9f; // 0.0-1.0
            choose.getWindow().setAttributes(winlp);
            choose.show();// 显示弹出框
        }
    });*/
    
    TabHost.TabSpec tSpecMessage = tabHost.newTabSpec("message");
    tSpecMessage.setIndicator(tabIndicator4);      
    tSpecMessage.setContent(new DummyTabContent(getBaseContext()));
    tabHost.addTab(tSpecMessage);
    
    TabHost.TabSpec tSpecMe = tabHost.newTabSpec("me");
    tSpecMe.setIndicator(tabIndicator5);        
    tSpecMe.setContent(new DummyTabContent(getBaseContext()));
    tabHost.addTab(tSpecMe);
}


找到Tabhost布局代码

public void findTabView(){
     tabHost = (TabHost) findViewById(android.R.id.tabhost);
     tabWidget = (TabWidget) findViewById(android.R.id.tabs);
     LinearLayout layout = (LinearLayout)tabHost.getChildAt(0);
     TabWidget tw = (TabWidget)layout.getChildAt(1);
     
     tabIndicator1 = (LinearLayout) LayoutInflater.from(this)
            .inflate(R.layout.tab_indicator, tw, false);
     TextView tvTab1 = (TextView)tabIndicator1.getChildAt(1);
     ImageView ivTab1 = (ImageView)tabIndicator1.getChildAt(0);
     ivTab1.setBackgroundResource(R.drawable.selector_mood_home);
     tvTab1.setText(R.string.buttom_home);
     
     tabIndicator2 = (LinearLayout) LayoutInflater.from(this)
            .inflate(R.layout.tab_indicator, tw, false);
     TextView tvTab2 = (TextView)tabIndicator2.getChildAt(1);
     ImageView ivTab2 = (ImageView)tabIndicator2.getChildAt(0);
     ivTab2.setBackgroundResource(R.drawable.selector_mood_wall);
     tvTab2.setText(R.string.buttom_wall);
     
     tabIndicator3 = (LinearLayout) LayoutInflater.from(this)
            .inflate(R.layout.tab_indicator, tw, false);
     TextView tvTab3 = (TextView)tabIndicator3.getChildAt(1);
     ImageView ivTab3 = (ImageView)tabIndicator3.getChildAt(0);
     ivTab3.setBackgroundResource(R.drawable.selector_mood_photograph);
     tvTab3.setText(R.string.buttom_camera);
      
     tabIndicator4 = (LinearLayout) LayoutInflater.from(this)
            .inflate(R.layout.tab_indicator, tw, false);
     TextView tvTab4 = (TextView)tabIndicator4.getChildAt(1);
     ImageView ivTab4 = (ImageView)tabIndicator4.getChildAt(0);
     ivTab4.setBackgroundResource(R.drawable.selector_mood_message);
     tvTab4.setText(R.string.buttom_message);
     
     tabIndicator5 = (LinearLayout) LayoutInflater.from(this)
            .inflate(R.layout.tab_indicator, tw, false);
     TextView tvTab5 = (TextView)tabIndicator5.getChildAt(1);
     ImageView ivTab5 = (ImageView)tabIndicator5.getChildAt(0);
     ivTab5.setBackgroundResource(R.drawable.selector_mood_my_wall);
     tvTab5.setText(R.string.buttom_me);
}


源代码下载链接: http://dwtedx.com/download.html?bdkey=s/1kUf0VhP 密码: 222z

若资源对你有帮助、浏览后有很大收获、不妨小额打赏我一下、你的鼓励是维持我不断写博客最大动力

想获取DD博客最新代码、你可以扫描下方的二维码、关注DD博客微信公众号(ddblogs)

或者你也可以关注我的新浪微博、了解DD博客的最新动态:DD博客官方微博(dwtedx的微博)

如对资源有任何疑问或觉得仍然有很大的改善空间、可以对该博文进行评论、希望不吝赐教

为保证及时回复、可以使用博客留言板给我留言: DD博客留言板(dwtedx的留言板)

感谢你的访问、祝你生活愉快、工作顺心、欢迎常来逛逛


快速评论


技术评论

  • 该技术还没有评论、赶快抢沙发吧...
DD记账
top
+