Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to chnag text color in menu #41

Open
yasirabid96 opened this issue Jan 31, 2020 · 3 comments
Open

how to chnag text color in menu #41

yasirabid96 opened this issue Jan 31, 2020 · 3 comments

Comments

@yasirabid96
Copy link

No description provided.

@arslan555
Copy link

Still looking for it @yasirabid96. Do you find any solution.

@FaridBen95
Copy link

@arslan555 @arslan555 create a class that extends from DuoOptionView
copy the code from DuoOptionView to your class
copy the ressource file from duo_view_option to a new ressource file
remove the text and change the text color in the text view
change the layout in the class to your new ressource file
set the text color in the constructor of OptionViewHolder
and then use your customeDuoOptionView class instead of DuoOptionView inside your adapter

@Hamza417
Copy link

Just go to your MenuAdapter, find the view like this

TextView textView = optionView.getRootView().findViewById(R.id.duo_view_option_text);

then set the text color

textView.setTextColor(Color.BLACK);

you can do the same with the dots as well,

ImageView imageView = optionView.getRootView().findViewById(R.id.duo_view_option_selector);

// Create your own shape drawable for the dot first, then set it like this
imageView.setImageResource(R.drawable.ic_circle);

for reference, you getView should look like this

@Override
   public View getView(int position, View convertView, ViewGroup parent) {
       final String option = mOptions.get(position);
       
       // Using the DuoOptionView to easily recreate the demo
       final DuoOptionView optionView;
       if (convertView == null) {
           optionView = new DuoOptionView(parent.getContext());
       } else {
           optionView = (DuoOptionView) convertView;
       }
       
       TextView textView = optionView.getRootView().findViewById(R.id.duo_view_option_text);
       textView.setTextColor(Color.BLACK);
   
       ImageView imageView = optionView.getRootView().findViewById(R.id.duo_view_option_selector);
       imageView.setImageResource(R.drawable.ic_circle);
       
       // Using the DuoOptionView's default selectors
       optionView.bind(option, null, null);
       
       // Adding the views to an array list to handle view selection
       mOptionViews.add(optionView);
       
       return optionView;
   }

Not sure its the best way but it works right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants