【问题标题】:iosched DashboardLayout elementes showing as vertical linearlayoutiosched DashboardLayout 元素显示为垂直线性布局
【发布时间】:2011-11-04 00:47:45
【问题描述】:

我正在使用来自 code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java 的 roman 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>

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

这是当前屏幕上显示的屏幕截图

【问题讨论】:

    标签: android android-layout dashboard


    【解决方案1】:

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

    一种方法让它按照你的意愿行事,那就是添加另一个图标。 (即使它只是一个空的 TextView)。这样您就可以获得 2x3 或 3x2 单元格,而不会受到惩罚。

    另一种方法是更新惩罚乘数 (UNEVEN_GRID_PENALTY_MULTIPLIER)。将其设置为 2 或 1,它应该更符合您的要求。

    【讨论】:

    • 我添加了一个虚拟视图只是为了使其平衡,感谢您帮助我。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-26
    • 2015-07-27
    • 1970-01-01
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    相关资源
    最近更新 更多