DatePickerDialog displays with two borders


Problem:

I have a question about DatePickerDialog displaying.

I want to create date picker dialog with "HoloDialog" theme like this:

DatePickerDialog dpd = new DatePickerDialog(this, android.R.style.Theme_Holo_Dialog, reservationDate, 2014, 1, 1);

Then I will see this result: DatePickerDialog with Holo_Dealog

As you can see, dialog is displayed with "two borders" around.

I want to create the same dialog as displayed here, but with one border around. Is it possible?


Solution:

Assuming I understand your question correctly, I think I found a way. Here, we anonymously subclass DatePickerDialog to override onCreate() and set a transparent background for the window.

DatePickerDialog dpd = new DatePickerDialog(this, android.R.style.Theme_Holo_Dialog,
                                            reservationDate, 2014, 1, 1) {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
};

You could also do this with a custom theme instead. For example:

<style name="HoloDialog" parent="@android:style/Theme.Holo.Dialog">
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

Then pass that in the DatePickerDialog's constructor:

DatePickerDialog dpd = new DatePickerDialog(this, R.style.HoloDialog,
                                            reservationDate, 2014, 1, 1);

Recent Tips

  1. "type 'double' is not a subtype of type 'int' in type cast" error in flutter. What should i do?
  2. hiding the autocomplete list when user click outside the textbox is not working as expected
  3. JSF IceFaces basic problem with redisplaying input value
  4. How to validate material ui TextField in reactjs?
  5. Go and MongoDB connection won't work with panic log "no reachable server"
  6. WordPress Posts Pagination Not Working
  7. F# sprintf won't print in interactive console
  8. Spring Integration get FTP files recursively with outbound-gateway
  9. Jade mixins not getting working from external file
  10. Can not access defined exports from the webpack bundle?
  11. Completely new to Node.js - API Programming
  12. Formatting Compare-Object Ouput
  13. Add dynamically added textbox value from User Control to main form
  14. Create a ByteBuf in Netty 4.0
  15. Is it possible to do computation before super() in the constructor?
  16. Q-learning Updating Frequency
  17. Wrong reload order when using Gulp and browserSync
  18. I use hugo build static page. But don't have content
  19. How to change background color and set bar colors based on conditional formatting in VBA?
  20. Problem when comparing two numeric values in SAS
  21. Is ACE reactor timer managment thread safe?
  22. Why Express res.render dumps the render output (EJS template) in console?
  23. Define generic typescript sort function of a certain type
  24. Eclipse RCP: TableViewer setInput from another view
  25. Migrating data from RDBMS to Arango DB: Bulk upload
  26. How can I check the existence of a key/file on an Amazon S3 Bucket using AWS iOS SDK v2?
  27. Can exponentially long bitstrings be stored in (and retrieved from) qubits reliably?
  28. Django refuses to save the date shown on form
  29. Debug output mentions I should ask for Application Badge permission
  30. Scrapy - Trouble getting output from xpath/css