欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  技术分享

Android高仿去哪儿酒店预定UI应用APP源代码下载

程序员文章站 2022-03-01 12:40:38
...

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

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

Android高仿去哪儿酒店预定UI应用APP源代码下载


首页初始化选项卡

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