我正在创建一个应用程序。我正面临着一个piquliear问题。我已经在所有三星设备,htc deivces,索尼设备,平板电脑上运行我的应用程序。但是在其中很少的布局不是应该如此。
我在这里张贴了一个屏幕截图。
现在你可以看到在地球图像之后第二张图像后面有一个间隙。在地球图像中我正在使用图库视图,在星座图像中我正在使用网格视图。现在这个空白并没有出现我测试的设备,但在少数设备中,这个差距即将来临。为什么?
我发布了布局文件。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"
android:weightSum="2"
>
<ListView
android:id="@+id/mylistcat"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</ListView>
<com.origamilabs.library.views.StaggeredGridView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:staggered="http://schemas.android.com/apk/res-auto"
android:id="@+id/gridviewrashisuggestions"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="bottom"
android:layout_marginLeft="0.5dp"
android:layout_marginRight="0.5dp"
android:stretchMode="columnWidth"
staggered:drawSelectorOnTop="false"
staggered:numColumns="1" />
现在我的列表视图有一个列表row.xml,网格视图只有一个图像。我怎样才能缩小差距?来自哪里?我使用布局权重= 2,我将它设置为listview = 1和gridview = 1那么差距是如何产生的?
请帮助...这是一个索尼实验模型的问题。它的高度越多但宽度越小。这个特殊的布局工作正常,其中高度和宽度几乎在物理设备中调整。像三星和htc。答案 0 :(得分:0)
你想要达到什么目的?设置重量同样意味着LinearLayout中两个元素的高度相等。为了更好地理解差距来自哪里,尝试为各个元素设置不同的背景颜色。
看起来星座视图被裁剪,因为它没有足够的空间,因为上方的视图占据了屏幕的一半。