即時通訊新的與Android。android標籤圖標不顯示
現在我試圖讓工作選項卡布局。我已經完成了一切,就像在Android TabView教程中,應用程序運行正常,但問題是我沒有看到任何圖標,我已經在ic_tab_artists.xml中定義它們。只有文字。
我想它與默認的主題是什麼或風格或什麼。我試圖改變它,但它根本沒有幫助,只是一個文本。
我正在使用Android SDK v4.03。
我確定有足夠的Android大師會提供幫助,所以在此先感謝。
這是我的.xml定義使用圖標:
?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="@drawable/ic_tab_artists_grey"
android:state_selected="true" />
<!-- When not selected (default), use white-->
<item android:drawable="@drawable/ic_tab_artists_white" />
</selector>
而我的主要HolePage活動:
@SuppressWarnings("deprecation")
public class HolePage extends TabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hole_page);
//TABS
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, HolePageScores.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("scores").setIndicator("Scores",
res.getDrawable(R.drawable.tab_scores_icons))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs - Info
intent = new Intent().setClass(this, HolePageInfo.class);
spec = tabHost.newTabSpec("info").setIndicator("Info",
res.getDrawable(R.drawable.tab_scores_icons))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs - Top
intent = new Intent().setClass(this, HolePageTop.class);
spec = tabHost.newTabSpec("top").setIndicator("Top",
res.getDrawable(R.drawable.tab_scores_icons))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs - Hole
intent = new Intent().setClass(this, HolePageHole.class);
spec = tabHost.newTabSpec("hole").setIndicator("Hole",
res.getDrawable(R.drawable.tab_scores_icons))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs - Par
intent = new Intent().setClass(this, HolePagePar.class);
spec = tabHost.newTabSpec("par").setIndicator("Par",
res.getDrawable(R.drawable.tab_scores_icons))
.setContent(intent);
tabHost.addTab(spec);
//Set default tab2
tabHost.setCurrentTab(1);
}
}
你可以發佈你的代碼嗎?你可以通過代碼設置你的圖標..你做到了嗎? – Hiral 2012-02-10 09:59:02
當然,如果你的意思是.xml,它定義了要加載哪些圖標以及何時> – 2012-02-10 10:01:11
,請編輯你的問題並在其中放置代碼! – Hiral 2012-02-10 10:04:30