Closed amrboxit4me closed 6 years ago
I tried to made breakpoints but it doesn't stop in the adapter I think it doesn't use it
It is worked I have to remove app:segments="@array/switch_array"
and I add it programmatically
ArrayList<CharSequence> segmentDataList = new ArrayList<>();
segmentDataList.add("On");
segmentDataList.add("Off");
segmentedShipSwitch.addSegments(segmentDataList);
so app:segments="@array/switch_array"
force use default adapter
Use the following to flip text on the adapter
segmentedShipSwitch.findSegmentByAbsolutePosition(this.isEasyShip ? 0 : 1).setSelected(true);
segmentedShipSwitch.findSegmentByAbsolutePosition(this.isEasyShip ? 1 : 0).setSelected(false);
instead ofsegmentedShipSwitch.setSelectedSegment(this.isEasyShip ? 0 : 1);
I can't find a method to change segment text so I made a custom adapter and I override this method
then I used this adapter in my activity by this code
segmentedShipSwitch.setAdapter(new ShipSegmentAdapter());
but segment text not fliped