开发者

Charts in TabActivity?

In my Android app I have a TabActivity, with 3 tabs. In one of them I want to display a chart. I made the chart but I don't know how to display in my tab. Is it possible?

I tried something like that :

            spec = getTabHost().newTabSpec("tag3");
    spec.setContent(R.id.details);
    spec.setIndicator(lv);

    spec.setIndicator("Details", get开发者_运维问答Resources()
            .getDrawable(R.drawable.list));
    getTabHost().addTab(spec);

where lv is: lv = new LineView(this);

    lv.setTitle("Budget");

    lv.setAxisValueX(budget);

    lv.setItems(items);

But, nothing happens. Any idea what should I do?


Create an Activity, display your Chart in the Activity and make the TabActivity launch that activity in the Tab you want.

Intent intent = new Intent().setClass(this, Chart.class);
spec=tabHost.newTabSpec("home").setIndicator("",res.getDrawable(R.drawable.list)).setContent(intent);
tabHost.addTab(spec);

where Chart (from Chart.class) is the Activity where the Chart is.

Hope this helps you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜