【发布时间】:2013-01-30 05:44:03
【问题描述】:
我已经尝试在布局文件的根元素上将layout_width 属性设置为match_parent 和fill_parent,用于主屏幕小部件。但是当在 App Widget 中显示时,它仍然被包裹在内容周围。
应用小部件布局:
<StackView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/xxxxxxxxx"
android:layout_width="match_parent" <!-- always acts like wrap_content -->
android:layout_height="fill_parent"
android:gravity="center"
android:loopViews="true" />
小部件被分配了 4X2 的网格大小:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="250dp"
android:minHeight="110dp"
. . . . . />
但是在添加到主屏幕后,小部件的宽度在主屏幕上不会占用 4 个网格,它只是围绕内容。如何解决?
【问题讨论】:
标签: android android-layout android-widget