我有一个基于 GridView 的日历。我有以下 XML 布局,其中选择器设置为 nullandroid:listSelector="@null"
根据我从这个网站得到的建议。现在我在 GridView 右侧得到了几个像素宽的条带。为什么?我已尽一切努力,但无济于事。这是我的 XML 布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<GridView
android:id="@+id/calendar"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:horizontalSpacing="-1px"
android:numColumns="7"
android:stretchMode="columnWidth"
android:gravity="center"
android:verticalSpacing="-1px"
android:listSelector="@null" >
</GridView>
</LinearLayout>
我得到的是这张图片:
这个空间是由于网格每行的计算不完美造成的。
例如,您的设备宽度为 320 像素,并且有 7 行,请尝试任何满足 320 像素的计算。如果每个单元格的宽度为45.71428571428571 px,则只能减小。
其他选项
apply
机器人:重力=“中心”网格中的属性,以便空间从左到右均等分配
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)