Solve the problem of incorrect display of dialogfragment width

I wrote a download box. Relative layout for layout files   I wrote it. It is found that the width cannot be set on Android 11 devices. The layout controls are stacked together.

Solution:

1. Wrap the outermost layer with FrameLayout and match the width and height_ parent

 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <RelativeLayout
        android:id="@+id/bg"
        android:layout_width="600dp"
        android:layout_height="wrap_content"
        android:background="@drawable/bg"
        >
		
		Other sub-controls
</RelativeLayout>
</FrameLayout>

Read More: