The widget size is different when testing at the local and publishing level - the same phone

I created a small widget that I want to be 80w X 100h in size. On my phone, this works great when I test it without a subscription. But as soon as I publish the application and test the widget on my phone, it is 160w x 200h ...

My widget background is 80w x 100h.

My widget provider xml file below

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:updatePeriodMillis="10000"
    android:minWidth="80px"
    android:minHeight="100px"
    android:initialLayout="@layout/widget"/>

My widget.xml layout is

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/widget_base"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:padding="10dip"
  android:orientation="vertical"
  android:background="@drawable/widget_background">
  <TextView
    android:id="@+id/widget_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Take Snap"
    android:textColor="#000000"
    android:layout_alignParentTop="true"
    android:layout_centerInParent="true"/>
  <ImageButton
    android:id="@+id/widget_snap"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_below="@id/widget_text"
    android:background="@xml/widget_button_state"
    />
    </RelativeLayout>
+3
source share
1 answer

I think you should use dp instead of px (using px is rarely a good idea):

android:minWidth="80dp"
android:minHeight="100dp"
+3
source

Source: https://habr.com/ru/post/1795083/


All Articles