I have a ScrollView
inside of DialogFragment
that scrolled fine until I realized that the dialog shouldn't have a title, so I called (in onCreateView
)
requestFeature(Window.FEATURE_NO_TITLE);
Then the ScrollView
doesn't allow scrolling anymore and the bottom views are squished together. The ScrollView
contains a vertical LinearLayout
with some views that should overflow the screen.
Flexible and scrollable bottom sheet. All you have to do is call showFlexibleBottomSheet() and you'll get a popup that looks like a modal bottom sheet and can be resized by dragging it up and down and scrolled when expanded. There are 2 types of BottomSheets: BottomSheet.
Showing the DialogFragment Instead, use the show() method to display your dialog. You can pass a reference to a FragmentManager and a String to use as a FragmentTransaction tag.
In Android, a ScrollView is a view group that is used to make vertically scrollable views. A scroll view contains a single direct child only. In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it.
You should set custom theme for your fragment dialog by inheriting current android dialog and adding windowSoftInputMode option:
<style name="DialogFragmentStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowSoftInputMode">stateHidden|adjustResize</item>
</style>
Use your theme in your fragment dialog while creating constructor
Dialog dialog = new Dialog(getActivity(), R.style.DialogFragmentStyle);
public class MyFragmentDialog extends DialogFragment{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Dialog dialog = new Dialog(getActivity(), R.style.DialogFragmentStyle);
//stuff
return dialog;
}
//... other methods
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With