-1

So I have a challenge similar to this post, to change the OK and Cancel button texts on Android and have been reading about Android resources, therefore decided I shall have my \Resources\values\Strings.xml edited in my Android project and containing two dedicated ok/cancel key-values.

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <string name="library_name">My App</string>
   <string name="ok">Fine</string>
   <string name="cancel">Nope</string>
</resources>

File build action for my XML is set to AndroidResource, although this does not impact the Picker ok/cancel button texts. What have I missed? It has to be working according to docs.

Thanks in advance

Dawid Ireno
  • 49
  • 1
  • 6

1 Answers1

1

this does not impact the Picker ok/cancel button texts.

Your Application string resources:

  • Resource.String. --> Resources\values\Strings.xml

System string resources:

  • Android.Resource.String.

For more Android.Resource information, you could read this.

You could find it in Source code that it use the android string resource :

builder.SetNegativeButton(global::Android.Resource.String.Cancel, (s, a) => ...
builder.SetPositiveButton(global::Android.Resource.String.Ok, (s, a) => ...

So you cant change the Ok and Cancel text. As mister_giga said, if you still want change the text, you have to reinvent whole bicycle.

Update :

I have write a custom PickerRenderer to implement your feature, and I have post my code here . Hope this can help you.

Effect.

York Shen
  • 9,014
  • 1
  • 16
  • 40