aurelhubert / aurelhubert/ahbottomnavigation

Colors aren't working!!

Open
#339 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
3.8k
Forks
672
PR merge metrics
No merged PRs in 30d

Description

I've tried all constructors of Navigation Items,
Setting up the setAccentColor(), setInactiveColor(),
But the active and inactive colors of text and icon aren't changing!
It gets a default color from nowhere.

my activity code :

`

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity
implements AHBottomNavigation.OnTabSelectedListener{

AHBottomNavigation bottomNavigation;

ArrayList bottomNavigationItems;

AHBottomNavigationItem navigationHomeItem;
AHBottomNavigationItem navigationTrendingItem;
AHBottomNavigationItem navigationReviewItem;
AHBottomNavigationItem navigationSuggestionItem;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

bottomNavigation = findViewById(R.id.bottom_navigation);

setupBottomNavigationView();

}

private void setupBottomNavigationView(){

setNavigationItems();

bottomNavigation.setOnTabSelectedListener(this);

bottomNavigation.setDefaultBackgroundColor(getResources().getColor(R.color.white));
bottomNavigation.setAccentColor(R.color.colorPrimary);
bottomNavigation.setInactiveColor(R.color.black);
bottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);

bottomNavigation.setForceTint(true);

bottomNavigation.setCurrentItem(0);

}

private void setNavigationItems(){

navigationHomeItem = new AHBottomNavigationItem(getResources().getString(R.string.title_home), R.drawable.ic_home_black_24dp);
navigationTrendingItem = new AHBottomNavigationItem(getResources().getString(R.string.title_trending), R.drawable.ic_dashboard_black_24dp);
navigationReviewItem = new AHBottomNavigationItem(getResources().getString(R.string.title_review), R.drawable.ic_notifications_black_24dp);
navigationSuggestionItem = new AHBottomNavigationItem(getResources().getString(R.string.title_suggestion), R.drawable.ic_home_black_24dp);

/*
navigationHomeItem = new AHBottomNavigationItem(R.string.title_home, R.drawable.ic_home_black_24dp, R.color.colorPrimary);
navigationTrendingItem = new AHBottomNavigationItem(R.string.title_trending, R.drawable.ic_dashboard_black_24dp, R.color.colorPrimary);
navigationReviewItem = new AHBottomNavigationItem(R.string.title_review, R.drawable.ic_notifications_black_24dp, R.color.colorPrimary);
navigationSuggestionItem = new AHBottomNavigationItem(R.string.title_suggestion, R.drawable.ic_home_black_24dp, R.color.colorPrimary);
*/

bottomNavigationItems = new ArrayList<>();
bottomNavigationItems.add(navigationHomeItem);
bottomNavigationItems.add(navigationTrendingItem);
bottomNavigationItems.add(navigationReviewItem);
bottomNavigationItems.add(navigationSuggestionItem);

bottomNavigation.addItems(bottomNavigationItems);

/*
bottomNavigation.addItem(navigationHomeItem);
bottomNavigation.addItem(navigationTrendingItem);
bottomNavigation.addItem(navigationReviewItem);
bottomNavigation.addItem(navigationSuggestionItem);
*/

}

@Override
public boolean onTabSelected(int position, boolean wasSelected) {

return true;
}
}
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the MainActivity.setupBottomNavigationView() and setNavigationItems() entry points shown in the report, then inspect AHBottomNavigation's color setters and AHBottomNavigationItem constructors. Reproduce the example with setAccentColor(), setInactiveColor(), setForceTint(), and addItems(); done means active and inactive text and icon colors follow the configured values.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.