I'm trying to place my DialogFragment
completely to right side of the phone. Strangely it worked before, but I don't know what I exactly I did, but I know it's possible.
As you can see on the picture there is a little amount of space between the DialogFragment
and the right side of the screen. I don't want that space at all. The fragment has to be completely on the right side.
My DialogFragment class:
public class FontFragment extends DialogFragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fontmenu, container);
recyclerView = (RecyclerView) v.findViewById(R.id.fontmenuRcv);
recyclerView.setHasFixedSize(true);
FontMenuAdapter fontsAdapter = new FontMenuAdapter(Font.initFonts(getContext()), editText, getContext(), editText.getSelectionStart(), editText.getSelectionEnd(), this);
recyclerView.setAdapter(fontsAdapter);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
return v;
}
@Override
public void onResume() {
getDialog().getWindow().setGravity(Gravity.RIGHT|Gravity.BOTTOM);
super.onResume();
}
}
The layout for the dialogfragment:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fontmenuRcv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>