在 android 中将旋转设置为对话框

set Rotation to dialog in android

您好,我想像这张图片一样设置对话框旋转度数

为此,我尝试从自定义布局中设置旋转并为其设置旋转,但是 当我这样做时,我的对话框被裁剪成这张图片
那么有人可以帮我解决这个问题吗?

我的对话框自定义布局:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/propel_shape"
android:orientation="vertical"
android:id="@+id/base_popup_layout"
android:layout_gravity="center_horizontal|center_vertical"
>

</LinearLayout>

我的代码:

baseLayout = (LinearLayout) findViewById(R.id.base_popup_layout);
baseLayout.setRotation(15);

尝试扩展该元素父元素的宽度和高度

是否没有足够的 space 可供查看?因为我试过 运行 你的代码,并且形状是按照你的要求渲染的,也就是说,它没有被裁剪。

从第二张截图可以看出,视图边界在旋转后没有改变,所以如果视图没有足够space,将无法正常显示。