激活其他标签页时如何更改标签页标题

时间:2012-10-24 08:25:19

标签: android tabpage

第1页: "setTitle 1st Tab" text should be changed when I activate other tab page

第2页: "setTitle 2nd Tab" should be shown when I click (activate) second tab page

您好我正在使用Android ActionBarSherlock:我遇到了麻烦: 当我更改标签页时如何更改标题栏文本,对不起这个简单的问题,但这花了我很多时间(不成功)

谢谢!

2 个答案:

答案 0 :(得分:0)

我认为动态创建TextView。

 TextView tv=new TextView(this);
  tv.setText("Your Title");

或者如果使用相同的XML TextView那么: -

   TextView tv=(TextView)findViewById(R.id.xmlname);
   tv.setText("title");

答案 1 :(得分:0)

您无法使用以下标题设置标题:

ActionBar ab = getSupportActionBar();
    ab.setTitle("yourTitle");

每次更改标签时。

相关问题