Android以编程方式更改标签页图像和文本

时间:2013-04-28 05:50:33

标签: android

我正在开发android选项卡应用程序,我想用实际的方式更改标签栏内容,在我的标签栏中有ImageViewTextView我需要更改{{1}图片和Imageview文字。

TextView

这段代码也不起作用..!

2 个答案:

答案 0 :(得分:0)

您可以使用以下代码进行更改

TextView title = (TextView )tabGroup.getChildAt(0).findViewById(R.id.tv);
title.setText("Your text");

答案 1 :(得分:0)

    ImageView tabImage = (ImageView )tabHost.getTabWidget().getChildAt(1).findViewById(R.id.ordericon);
    TextView tabText = (TextView )tabHost.getTabWidget().getChildAt(1).findViewById(R.id.orders_label);