Android SingleChoice AlertDialog无法正常工作

Android SingleChoice AlertDialog无法正常工作,android,android-layout,apk,android-alertdialog,Android,Android Layout,Apk,Android Alertdialog,有人能帮我吗?我想删除每个项目的选择圈和选择文本之间的空格(如图所示)。我的意思是我要把每一个选项的文本粘在圆圈上。为此,我在onCreate()方法中调用了一个方法。提前通知Tnx。这是我的密码: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Bui

有人能帮我吗?我想删除每个项目的选择圈和选择文本之间的空格(如图所示)。我的意思是我要把每一个选项的文本粘在圆圈上。为此,我在onCreate()方法中调用了一个方法。提前通知Tnx。这是我的密码:

  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (Build.VERSION.SDK_INT >= 17)
    {
        Locale fa = new Locale ( "fa" );
        Locale.setDefault ( fa );

        Configuration config = new Configuration ();
        config.locale = fa;
        getApplicationContext ().getResources ().updateConfiguration ( config, getApplicationContext ().getResources ().getDisplayMetrics () );
    }
   //fa is a Rtl language
    getWindow ().setFlags ( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );

    alert();
}

 public void alert() {
    final AlertDialog.Builder ad = new AlertDialog.Builder(this);
    ad.setTitle(" چته ؟ ");
    ad.setCancelable(false);

    ad.setSingleChoiceItems(mylist, -1, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Toast.makeText(getApplicationContext(), "you choose : " + mylist[which], Toast.LENGTH_SHORT).show();
        }
    });
    ad.setPositiveButton(" تایید ", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Toast.makeText(getApplicationContext(), "you confirm", Toast.LENGTH_SHORT).show();
        }

    });


    ad.setNegativeButton(" انصراف ", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Toast.makeText(getApplicationContext(), "you canceled it", Toast.LENGTH_SHORT).show();
        }
    });
    final AlertDialog alertDialog = ad.create();
    alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            Button pos = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
            Button neg = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
             alertDialog.getWindow().setLayout(1000,800);
            pos.setTextSize(18f);
            neg.setTextSize(18f);

        }
    });

   alertDialog.show();
}

通过查看有关stackoverflow的其他问题,我发现这可能会对您有所帮助。
然后调整重力和填充以达到想要的效果。

通过查看stackoverflow上的其他问题,我发现这可能会对您有所帮助。 然后调整重力和填充以达到想要的效果