tronious
tronious

Reputation: 1577

Force Android widget to take up full width of screen

I'm having a difficult time getting this to work. The Android documentation, while seemingly straightforward, isn't getting me where I need to be.

What I want to accomplish is my Widget must be the width of the phone regardless of form factor.

I need it to be 4 x 1 (or 4 x 2 is fine even)...but it needs to fill the width.

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
  android:minWidth="250dp"
  android:minHeight="100dp"
  android:previewImage="@drawable/main_app_icon"
  android:initialLayout="@layout/initial_widget_layout"
  android:updatePriodMillis="0"/>

I understand that the minHeight is incorrect. Can you also offer some guidance on that?

Thanks.

EDIT: While I realize there are a number of threads talking about widgets, I cannot find one that explains how to make the widget fill the entire width of the screen.

Upvotes: 5

Views: 3282

Answers (1)

tronious
tronious

Reputation: 1577

My God...EVERY FREAKING TIME!!! Every time I post a question on StackOverflow I swear I immediately figure out the answer.

In short...in my layout for the widget (not the appwidgetprovider xml), I needed to set layout_width and layout_height = match_parent

Upvotes: 1

Related Questions