0
我跟着android developers tutorial成功創建了標籤。但似乎沒有直接的方法來定位設備屏幕的左側上的標籤。有什麼方法可以找到屏幕左側的選項卡嗎?
有沒有人知道一種方法來實現左側的選項卡?有沒有關於這方面的指導?
我跟着android developers tutorial成功創建了標籤。但似乎沒有直接的方法來定位設備屏幕的左側上的標籤。有什麼方法可以找到屏幕左側的選項卡嗎?
有沒有人知道一種方法來實現左側的選項卡?有沒有關於這方面的指導?
不,沒有。我也搜索了從右到左的支持,但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);
收費關注最後一行 - 即時將當前標籤設置爲最後一個 - 從右側開始。