开发者

Widget size different while testing on local and publishing - same phone

开发者 https://www.devze.com 2023-02-14 05:42 出处:网络
I have created a small widget which I want to be just 80w X 100h in size. On my phone this works fine when I am testing it un-signed. But as soon 开发者_开发问答as I publish the app and test the widge

I have created a small widget which I want to be just 80w X 100h in size. On my phone this works fine when I am testing it un-signed. But as soon 开发者_开发问答as I publish the app and test the widget on my phone it is 160w x 200h...

My widget background is 80w x 100h.

My widget provider xml file is 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>


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

android:minWidth="80dp"
android:minHeight="100dp"
0

精彩评论

暂无评论...
验证码 换一张
取 消