alexrainman / SegmentedControl

MIT License
86 stars 38 forks source link

text color is yellow instead of white on android #10

Closed julesx closed 7 years ago

julesx commented 7 years ago

https://github.com/alexrainman/SegmentedControl/blob/master/SegmentedControl/SegmentedControl.FormsPlugin.Android/SegmentedControlImplementation.cs#L100

i believe this should be

v.SetTextColor(Color.FromHex("#00ffffff").ToAndroid());

the developer can explicitly provide an 8-digit number that completely specifies the Alpha, Red, Green, and Blue channels, in that order.

alexrainman commented 7 years ago

I just made the Android version behaves exactly like ios where unselected tabs are transparent a selected one text is transparent also.

alexrainman commented 7 years ago

I understand your point now. Thanks

julesx commented 7 years ago

just to add, i think you should consider making the Tint color be the Accent color by default, it looks much better than the default color being used right now (which i believe is the default radio button colors)

alexrainman commented 7 years ago

I am using TintColor. I dont know what you mean by accent.

julesx commented 7 years ago

https://developer.xamarin.com/guides/xamarin-forms/working-with/colors/

Color.Accent Color.Default

these are named colors that are defined by the android OS theme. Currently I am doing this

      <abstractions:SegmentedControl.TintColor>
         <OnPlatform x:TypeArguments="Color">
          <OnPlatform.iOS>
            #007AFF
          </OnPlatform.iOS>
          <OnPlatform.Android>
            Accent
          </OnPlatform.Android>
        </OnPlatform>
      </abstractions:SegmentedControl.TintColor>
alexrainman commented 7 years ago

I still dont understand what you want :). I am using TintColor in unselected tabs text color, borders and selected tan background. Exactly as iOS component.

julesx commented 7 years ago

set the Tint color to Accent as the default color.

AndriiTsok commented 7 years ago

@julesx I agree we need an additional property for unselected background color and maybe for text color (selected normal).

For instance: http://prntscr.com/diq6y7

Looking for work around to make the unselected items background transparent and text color black.

alexrainman commented 7 years ago

I am using TintColor in unselected tabs text color, borders and selected tab background. Exactly as iOS component and that wont change. I am adding a property to set selected tab text color, normally to provide the hability to match container background color, as transparent doesnt works.

alexrainman commented 7 years ago

UISegmentedControl uses TintColor for selected segment background color, unselected segments text color and border color. I am matching that.

julesx commented 7 years ago

If you set the text colour to Color.Default it should be visible both selected and not. A property certainly wouldn't hurt though.

alexrainman commented 7 years ago

As i said, Android control is intent to mimic iOS counterpart and that's the way it should be.

flippinloud commented 6 years ago

If you set the background color (to white for instance), it colors outside the border of the control. It means if I want white buttons with blue selected button and blue borders, there is white drawn outside the button itself.

                                    <segControl:SegmentedControl x:Name="YearSplitButton" 
                                        TintColor="Blue"
                                        BackgroundColor="White"
                                        SelectedTextColor="White"
                                        SelectedSegment="0" Grid.Row="0" Grid.ColumnSpan="3"  HeightRequest="30" Margin="0,10,0,10">
                                      <segControl:SegmentedControl.Children>
                                        <segControl:SegmentedControlOption Text="2016" />
                                        <segControl:SegmentedControlOption Text="2017" />
                                        <segControl:SegmentedControlOption Text="2018" />
                                      </segControl:SegmentedControl.Children>
                                    </segControl:SegmentedControl>