0

私はそうのようなAlertDialogを作成しました:Androidのキャンセルボタンのテキストを変更しますか?

AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 

そして、私は、ボタンを設定している:

return builder.setTitle(titleText).setView(mDialogLayout) 
       .setNegativeButton(android.R.string.cancel, null).create(); 

は、私以外の何かを言うために「NegativeButton」を変更することができる方法はあります"キャンセル"?

答えて

2

変更この:

return builder.setTitle(titleText).setView(mDialogLayout) 
       .setNegativeButton(android.R.string.cancel, null).create(); 

へ:

return builder.setTitle(titleText).setView(mDialogLayout) 
       .setNegativeButton("Text you need", null).create(); 

setNegativeButtonメソッドの最初の引数は、テキストを取ることができます。

1

はい、setNegativeButtonの最初の引数に独自のテキストリソースを指定するだけです。現在、あなたはそれとAndroidプラットフォームの文字列を与えています。

関連する問題