Last active
July 9, 2018 07:12
-
-
Save Mugurell/76ecf66a7f09facf5aa578928103dc13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the widget | |
final DatePicker input = new DatePicker(context); | |
.... | |
final View view = (View) input; | |
// Wrap the widget in a LinearLayout to prevent it from being chopped | |
final LinearLayout widgetWrapper = new LinearLayout(context); | |
final LinearLayout.LayoutParams parentParams = new LinearLayout.LayoutParams( | |
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); | |
parentParams.gravity = Gravity.CENTER; | |
view.setLayoutParams(parentParams); | |
widgetWrapper.addView(v); | |
// Add the wrapped view to the AlertDialog | |
// Impossibility to scroll certain layouts still exists | |
AlertDialog.Builder builder = new AlertDialog.Builder(context); | |
.... | |
builder.setView(widgetWrapper); | |
builder.create().show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment