Hallo Forum,
ich würde gerne die TabHeader Back und Foreground Color ändern nur wie ? Kennt Ihr Links oder wisst Ihr wie das geht ? Mein Code bis jetzt:
TabListener.java
Java
int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
if (actionBarTitleId > 0) {
TextView title = (TextView) findViewById(actionBarTitleId);
if (title != null) {
title.setTextColor(Color.BLACK);
}
}
MainActivity.java
Java
package com.launchtalk;
import android.os.Bundle;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actBar = getActionBar();
actBar.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
actBar.setTitle("");
actBar.setIcon(getResources().getDrawable(R.drawable.launchtalk_font));
actBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
if (actionBarTitleId > 0) {
TextView title = (TextView) findViewById(actionBarTitleId);
if (title != null) {
title.setTextColor(Color.BLACK);
}
}
Tab eTab = actBar.newTab()
.setText("Explore")
.setTabListener(new TabListener<ExploreFragment>(
this, "explore", ExploreFragment.class));
actBar.addTab(eTab);
Tab fTab = actBar.newTab()
.setText("Featured Talks")
.setTabListener(new TabListener<FeaturedFragment>(
this, "featured", FeaturedFragment.class));
actBar.addTab(fTab);
Tab aTab = actBar.newTab()
.setText("All Talks")
.setTabListener(new TabListener<AllTalksFragment>(
this, "all", AllTalksFragment.class));
actBar.addTab(aTab);
Tab uTab = actBar.newTab()
.setText("Upcoming Events")
.setTabListener(new TabListener<EventsFragment>(
this, "events", EventsFragment.class));
actBar.addTab(uTab);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Display More
Unten noch ein Bild was ich mit TabHeader meine
Gruß,
Jan