我按照android developers tutorial成功创建了标签。但似乎没有直接的方法可以在设备屏幕的左侧找到标签。
有没有人知道实施左手边标签的方法?关于这个有什么指导吗?
答案 0 :(得分:0)
不,没有。我也搜索了从右到左的支持,但在Android中没有这样的东西。
我所做的是操纵代码,以便用户感觉从右到左 - 我在XML中创建了3个选项卡,并在我的活动中添加了代码:
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);
为最后一行支付费用 - 我将当前标签设置为最后一个 - 首先从右边开始。