(I am working with Xamarin C# but the code is identical to Java)
I created a DialogFragment
which inflates a custom layout. The OnCreateView
looks like this :
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.Inflate(Resource.Layout.dialog_feedback, container);
int scale = Context.Resources.DisplayMetrics.HeightPixels;
int height = scale / 2;
Dialog.Window.SetLayout(ViewGroup.LayoutParams.MatchParent, height);
Dialog.Window.SetGravity(GravityFlags.Bottom | GravityFlags.CenterHorizontal);
return view;
}
And the OnCreate
looks like this :
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetStyle(0, Resource.Style.dialog_no_border);
}
Here's the style :
<style name="dialog_no_border" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
The layout that the dialog is inflating contains a ConstraintLayout
as the parent and has a AppCompatEditText
inside it.
When i open the dialog and click on the EditText, the keyboard overlaps the Edittext. What i'm trying to do is, when the keyboard pops up, it should push up the DialogFragment
and show the EditText above itself. How do i achieve that ?
I tried setting android:windowSoftInputMode="adjustNothing"
, android:windowSoftInputMode="adjustPan"
, android:windowSoftInputMode="adjustResize"
in the activity
tag inside the manifest, but with no luck!
So, how do i achieve this ?