小部件。视图尺寸错误

时间:2020-04-22 16:51:16

标签: android widget

我正在尝试将小部件内的视图尺寸设置为300 * 300像素。但是小部件显示的尺寸错误272 * 272像素。 如果用于活动的布局尺寸正确(300 * 300像素)。 因此,看起来小部件会减少所有视图。 有任何修复建议吗?

小部件的布局:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#80ff0000"
    >

    <FrameLayout
        android:padding="0dp"
        android:layout_margin="0dp"
        android:layout_width="300px"
        android:layout_height="300px"
        android:background="#80ffffff"
        android:layout_centerInParent="true"
        />

</RelativeLayout>

0 个答案:

没有答案