我想在图标上设置指示器以在滑动滑动选项卡时突出显示图标。就像Facebook安卓应用程序正在使用滑动选项卡。我试图在滑动选项卡上更改指示器的颜色
PagerTabStrip pagerTapStrip = (PagerTabStrip) findViewById(R.id.pager);
pagerTapStrip.setDrawFullUnderline(true);
pagerTapStrip.setTabIndicatorColor(Color.RED);
答案 0 :(得分:0)
这是我的java文件
public class Demo extends FragmentActivity implements ActionBar.TabListener {
private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;
// Tab titles
private String[] tabs = { "Schedule", "Attendance", "Bulletin Board" , "Drawer" };
final int[] ICONS = new int[] {
R.drawable.index,
R.drawable.bulletin_board,
R.drawable.change_password,
R.drawable.attendance_button_selected
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
// Initilization
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#207CAF")));
actionBar.setTitle("GEMS");
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Adding Tabs
/*for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(this));
} */