Androidで新しいです。アンドロイドタブのアイコンが表示されません
今すぐ仕事をしようとしています。私はAndroid TabViewチュートリアルのようにすべてをやりました。アプリケーションは正常に実行されますが、問題はic_tab_artists.xmlで定義されたアイコンが表示されないことです。テキストだけがあります。
私はテーマとは何かを持っていると思います。これはデフォルトのものか、スタイルか、これまでのものです。 Iveはそれを変更しようとしましたが、それはまだ助けてくれませんでした。
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活動:テーマについての深さで多くを知らなくても、私はでテーマ@android:style/Theme.NoTitleBar
を指定すること
@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
確かに、ロードするアイコンと> –
を定義する.xmlを意味する場合は、質問を編集してコードを入力してください! – Hiral