开发者

Is there any way to locate the tabs on the left hand side of the screen?

I followed the android developers tutorial successfully created the tabs. But seems there is no straight forward way to locate the tabs on the left hand side of device screen.

Is there anybody know a way to implement left hand side tabs?? Is there any guideline 开发者_如何学JAVAabout this?


No, there isn't. I've searched too for right-to-left support, but there's no such thing in Android.

What i did is to manipulate the code so the user will feel like its right to left - I've created 3 tabs in the XML, and added to my activity the code:

    final TabHost tabs = (TabHost) this.findViewById(R.id.tabhost);
    tabs.setup();
    TabHost.TabSpec spec;
    final Resources resources = this.getResources();

    // third tab (first from left)
    spec = tabs.newTabSpec("tag3");
    spec.setContent(R.id.aboutImg);
    spec.setIndicator(this.getString(R.string.title_about), resources.getDrawable(R.drawable.id));
    tabs.addTab(spec);

    // second tab
    spec = tabs.newTabSpec("tag2");
    spec.setContent(R.id.listfav);
    spec.setIndicator(this.getString(R.string.title_favorites), resources.getDrawable(R.drawable.bdge));
    tabs.addTab(spec);

    // first tab
    spec = tabs.newTabSpec("tag1");
    spec.setContent(R.id.viewflipper);
    spec.setIndicator(this.getString(R.string.title_main), resources.getDrawable(R.drawable.cab));
    tabs.addTab(spec);

    tabs.setCurrentTab(2);

Pay attantion for the last line - im setting the current tab to be the last one - first from right.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜