@Test @MediumTest public void testButtonVisibility() { final String positiveButtonText = "Positive button"; final String negativeButtonText = "Negative button"; final String neutralButtonText = "Neutral button"; AlertDialog.Builder builder = new AlertDialog.Builder(mActivityTestRule.getActivity()) .setTitle(R.string.alert_dialog_title) .setPositiveButton(positiveButtonText, null) .setNegativeButton(negativeButtonText, null) .setNeutralButton(neutralButtonText, null); wireBuilder(builder); onView(withId(R.id.test_button)).perform(click()); onView(withText(positiveButtonText)).inRoot(isDialog()).check( matches(isCompletelyDisplayed())); onView(withText(positiveButtonText)).inRoot(isDialog()).check( matches(not(hasEllipsizedText()))); onView(withText(negativeButtonText)).inRoot(isDialog()).check( matches(isCompletelyDisplayed())); onView(withText(negativeButtonText)).inRoot(isDialog()).check( matches(not(hasEllipsizedText()))); onView(withText(neutralButtonText)).inRoot(isDialog()).check( matches(isCompletelyDisplayed())); onView(withText(neutralButtonText)).inRoot(isDialog()).check( matches(not(hasEllipsizedText()))); }
@Override public void setTitle(CharSequence title) { super.setTitle(title); mAlert.setTitle(title); }
AlertDialog extends AppCompatDialog implements DialogInterface { @Override public void setTitle(CharSequence title) { super.setTitle(title); mAlert.setTitle(title); } }
AlertDialog extends AppCompatDialog implements DialogInterface { @Override public void setTitle(CharSequence title) { super.setTitle(title); mAlert.setTitle(title); } protected  AlertDialog(@NonNull Context context); protected  AlertDialog(@NonNull Context context, @StyleRes int themeResId); protected  AlertDialog(@NonNull Context context, boolean cancelable,
            @Nullable OnCancelListener cancelListener); }
AlertDialog extends AppCompatDialog implements DialogInterface { @Override public void setTitle(CharSequence title) { super.setTitle(title); mAlert.setTitle(title); } protected  AlertDialog(@NonNull Context context); protected  AlertDialog(@NonNull Context context, @StyleRes int themeResId); protected  AlertDialog(@NonNull Context context, boolean cancelable,
            @Nullable OnCancelListener cancelListener); Button getButton(int whichButton); ListView getListView(); @Override void setTitle(CharSequence title); void setCustomTitle(View customTitleView); void setMessage(CharSequence message); void setView(View view); void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight,
            int viewSpacingBottom); void setButton(int whichButton, CharSequence text, Message msg); void setButton(int whichButton, CharSequence text, OnClickListener listener); void setButton(int whichButton, CharSequence text, Drawable icon,
            OnClickListener listener); void setIcon(int resId); void setIcon(Drawable icon); void setIconAttribute(int attrId); @Override boolean onKeyDown(int keyCode, KeyEvent event); @Override boolean onKeyUp(int keyCode, KeyEvent event); }
AlertDialog extends AppCompatDialog implements DialogInterface { @Override public void setTitle(CharSequence title) { super.setTitle(title); mAlert.setTitle(title); } protected  AlertDialog(@NonNull Context context); protected  AlertDialog(@NonNull Context context, @StyleRes int themeResId); protected  AlertDialog(@NonNull Context context, boolean cancelable,
            @Nullable OnCancelListener cancelListener); Button getButton(int whichButton); ListView getListView(); @Override void setTitle(CharSequence title); void setCustomTitle(View customTitleView); void setMessage(CharSequence message); void setView(View view); void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight,
            int viewSpacingBottom); void setButton(int whichButton, CharSequence text, Message msg); void setButton(int whichButton, CharSequence text, OnClickListener listener); void setButton(int whichButton, CharSequence text, Drawable icon,
            OnClickListener listener); void setIcon(int resId); void setIcon(Drawable icon); void setIconAttribute(int attrId); @Override boolean onKeyDown(int keyCode, KeyEvent event); @Override boolean onKeyUp(int keyCode, KeyEvent event);  }