Hi all,
Looking at the Facebook widget I realized its a 4x2 cell and this isn't one of the standard sizes. I have tried to re-create a widget of this size (either as 320x200 or 294x146 px) however the widget doesn't look good on all devices. The widget layout is :
<?xml version="1.0" encoding="utf-8"?>
<!-- Portrait -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/widget"
android:background="@drawable/widget_bg"
>
<TextView android:id="@+id/widget_title"
android:layout_width="fill_parent"
android:layout_height="60dip"
android:layout_marginTop="1dip"
android:textSize="20.0sp"
android:maxLines="3"
android:textColor="#000"
android:textStyle="bold"
android:gravity="center"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:ellipsize="end"
/>
<ImageView android:id="@+id/widget_thumb"
android:layout_width="304dip"
android:layout_height="90dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="7dip"
android:src="@drawable/thumb_placeholder_large"
android:adjustViewBounds="true"
android:layout_below="@+id/widget_title"
android:background="#000"
/>
<!-- previous button -->
<Button
android:id="@+id/widget_previous"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:layout_marginBottom="35dp"
android:layout_alignParentBottom="true"
android:background="@drawable/left_button"/>
<!-- Next Button -->
<Button
android:id="@+id/widget_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:layout_marginBottom="35dp"
android:layout_alignParentBottom="true"
android:background="@drawable/right_button" />
<!-- Indicator -->
<LinearLayout
android:id="@+id/widget_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginBottom="33dp"
android:layout_marginRight="50dp"
android:layout_alignParentBottom="true">
<!-- ProgressBar throws exception when it's set invisible from RemoteViews use a layout wrapper instead -->
<ProgressBar
android:layout_width="15dp"
android:layout_height="15dp">
</ProgressBar>
</LinearLayout>
</RelativeLayout>
On the Motorola Droid this layout fits properly, however on other devices the ImageView sits way below. Any help/suggestions are appreciated.
The drawable_bg.png is 294x146px.
- Sandeep