开发者

iosched DashboardLayout elementes showing as vertical linearlayout

开发者 https://www.devze.com 2023-03-30 16:04 出处:网络
I am using roman Nurik\'s dashboard layout from code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java , however this is not working out can

I am using roman Nurik's dashboard layout from code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java , however this is not working out can anyone show what widgets works in it, I suppose ImageView is not a good choice

<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>

right now it is just showing all five images in a single vertical column at the center of screen.

here is the screenshot of what is currently appearing on screen

iosched DashboardLayout elementes showing as vertical linearlayout


I think you are just unlucky. The DashboardLayout tries to find the best configuration (number of rows and columns) based on the difference between the horizontal and vertical spaces. But it will penalize any configuration that does not get covered by the icons (one icon in every cell) by multiplying the score by 10.

One way to make it behave as you want, would be to add another icon. (Even if it just an empty TextView). This way you can get 2x3 or 3x2 cells, without being penalized.

Another way would be to update the penalization multiplier (UNEVEN_GRID_PENALTY_MULTIPLIER). Set it to 2 or 1, and it should work more like you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号