iosched DashboardLayout elementes显示为垂直linearlayout

Vai*_*hra 2 android dashboard android-layout

我正在使用来自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>
Run Code Online (Sandbox Code Playgroud)

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

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

仪表板显示为单行

Mar*_*rot 9

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

让它按照您的需要运行的一种方法是添加另一个图标.(即使它只是一个空的TextView).这样你就可以得到2x3或3x2的细胞,而不会受到惩罚.

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