iosched DashboardLayout elementes显示为垂直linearlayout

时间:2011-08-25 20:24:02

标签: android android-layout dashboard

我使用的是code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java中的罗马Nurik仪表板布局,但这是没有工作,任何人都可以显示其中的小工具,我想ImageView不是一个好选择

<com.vaibhavmishra.android.DashboardLayout
                android:id="@+id/dashboard" android:layout_height="fill_parent"
                android:layout_width="fill_parent" android:layout_weight="1">
                <ImageView android:src="@drawable/img1"
                    android:id="@+id/c_img1" android:layout_height="wrap_content"
                    android:layout_width="wrap_content"></ImageView>
                <ImageView android:src="@drawable/img2"
                    android:id="@+id/c_img2" android:layout_height="wrap_content"
                    android:layout_width="wrap_content"></ImageView>
                <ImageView android:src="@drawable/img3" android:id="@+id/c_img3"
                    android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
                <ImageView android:src="@drawable/img4"
                    android:layout_height="wrap_content" android:layout_width="wrap_content"
                    android:id="@+id/c_img4"></ImageView>
                <ImageView android:src="@drawable/img5" android:id="@+id/c_img5"
                    android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
            </com.vaibhavmishra.android.DashboardLayout>

现在它只是在屏幕中心的单个垂直列中显示所有五个图像。

这是当前出现在屏幕上的屏幕截图

dashboard shown as single line

1 个答案:

答案 0 :(得分:9)

我认为你只是运气不好。 DashboardLayout尝试根据水平和垂直空间之间的差异找到最佳配置(行数和列数)。但它会通过将得分乘以10来惩罚任何未被图标覆盖的配置(每个单元格中的一个图标)。

单向使其按照您的意愿运行,就是添加另一个图标。 (即使它只是一个空的TextView)。这样你就可以得到2x3或3x2的细胞,而不会受到惩罚。

另一种方式将更新惩罚乘数(UNEVEN_GRID_PENALTY_MULTIPLIER)。将它设置为2或1,它应该更像你想要的工作。