ActionBar


ActionBar actionBar = getActionBar();
             actionBar.setTitle( "1407勇士");
             // 设置小箭头
             // 默认true 如果是true,显示小箭头,能点击
             actionBar.setDisplayHomeAsUpEnabled( true );
             // 默认true,如果是false 隐藏图标和title
//          actionBar.setDisplayShowHomeEnabled(true);
             // 设置排列方式(导航方式) 设置横向排列
             actionBar. setNavigationMode(ActionBar. NAVIGATION_MODE_LIST);
             final String[] strArray = new String[] { "华山派", "古墓派" , "峨眉派" };
             // 准备数据适配器
            ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this ,
                        android.R.layout. simple_list_item_1 , android.R.id.text1 ,
                        strArray);

             actionBar. setListNavigationCallbacks(arrayAdapter, new OnNavigationListener() {

                   @Override
                   public boolean onNavigationItemSelected( int itemPosition, long itemId) {
                         // TODO Auto-generated method stub
                         return false;
                  }
            }) ;

             /*TabListener listener=new TabListener() {

                  @Override
                  public void onTabUnselected(Tab tab, FragmentTransaction ft) {
                        // TODO Auto-generated method stub
                        tab.getText().toString().trim();
                  }

                  @Override
                  public void onTabSelected(Tab tab, FragmentTransaction ft) {
                        // TODO Auto-generated method stub

                  }

                  @Override
                  public void onTabReselected(Tab tab, FragmentTransaction ft) {
                        // TODO Auto-generated method stub

                  }
            };

            actionBar.addTab(actionBar.newTab().setText("蛋黄派")
                        .setIcon(R.drawable.ic_launcher).setTabListener(listener));
            actionBar.addTab(actionBar.newTab().setText("勇士派")
                        .setIcon(R.drawable.ic_launcher).setTabListener(listener));
            actionBar.addTab(actionBar.newTab().setText("冻栋派")
                        .setIcon(R.drawable.ic_launcher).setTabListener(listener));*/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值