AlertDialog: How To Remove Black Borders Above and Below View

后端 未结 5 1721
难免孤独
难免孤独 2020-12-05 06:47

This question has been asked before: AlertDialog custom title has black border

But was not answered satisfactorily - and is missing some information.


I

5条回答
  •  时光取名叫无心
    2020-12-05 07:25

    dialog.setInverseBackgroundForced(true);
    

    use the above in your code to remove the border of the alert dialog.

    Refer this LINK for InverseBackgroundForced.

    UPDATED Try this code::::

    public class Welcome  extends Activity
    {
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.welcome);
    
            AlertDialog.Builder builder = new AlertDialog.Builder(Welcome.this);
            LayoutInflater _inflater = LayoutInflater.from(Welcome.this);
            View view = _inflater.inflate(R.layout.welcomedialog,null);
            builder.setView(view);
    
            AlertDialog alert = builder.create();
            alert.show();
        }
    }
    

    Note:: Also try by removing android:padding="40px" from welcomedialog.xml.

提交回复
热议问题