1

Like the title said it, the cardview become black with white texts, like inverted. Other cardview which not use Adapter is fine, though.

enter image description here

I have tried this and this but doesn't work. Google doesn't show much result with same situation.

In fragment:

allGroupsView = (RecyclerView) rootView.findViewById(R.id.allGroupsView);
adapterGroup = new AdapterGroup(getActivity().getApplicationContext(), results);
allGroupsView.setAdapter(adapterGroup);
allGroupsView.setLayoutManager(new LinearLayoutManager(getActivity().getApplicationContext()));

As in AdapterGroup,

public AdapterGroup(Context context, List<DataGroup> results) {
    this.mContext = context;
    inflater = LayoutInflater.from(mContext);
    this.data = results;
}

The links hinted about Context so my guess is I used it wrongly. After going around with context, none of it works. Is there something I missed?

Community
  • 1
  • 1
August
  • 309
  • 1
  • 5
  • 15
  • 1
    What styles are you applying to these views? Looks like the "inverted" views are styled with Theme.Material, rather than Theme.Material.Light. – emerssso Oct 24 '16 at 18:42
  • I use AppTheme style. I changed the xml for cardview to Material.Light but still inverted – August Oct 24 '16 at 18:57

1 Answers1

0

In my case i change:

mRambuAdapter = new RambuListAdapter(getApplicationContext(),mListRambu);

To

mRambuAdapter = new RambuListAdapter(this,mListRambu);

The context here should be an Activity- or Fragment Context - NOT the application-context.

Reference: https://stackoverflow.com/a/39882195/3086112

Community
  • 1
  • 1
Sucipto
  • 817
  • 1
  • 8
  • 19