网格视图右侧的未知空间

发布于 2024-09-13 02:51:31 字数 290 浏览 4 评论 0原文

我的xml代码是:

    <GridView android:id="@+id/gridView_calendar"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:layout_weight="1" android:numColumns="5"/>

但是gridView的右侧出现空白。它的大小似乎适合滚动条。我不知道它是怎么来的。有人可以帮助我吗?谢谢!

My xml code is:

    <GridView android:id="@+id/gridView_calendar"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:layout_weight="1" android:numColumns="5"/>

But there appear to the right of the gridView a blank. Its size seems for scroll bar. I don't know how it comes. Can anybody help me? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

二智少女 2024-09-20 02:51:31

已经解决了。这是 GridView 的左侧空间。

设置屏幕宽度为totalX。 gridView节点宽为deltaX,网格数为n,则未知空间为:
总计X - deltaX*n。

但是有没有什么API可以避免这个空间呢?

Already solved. It's the left space for GridView.

Set screen wide is totalX. gridView node wide is deltaX, grid count is n, then the unknown space is:
totalX - deltaX*n.

But is there any api to avoid this space?

硪扪都還晓 2024-09-20 02:51:31
android:stretchMode="spacingWidthUniform"

或任何其他拉伸模式,请参阅:
http://developer.android.com/reference/android/widget /GridView.html#attr_android:stretchMode

android:stretchMode="spacingWidthUniform"

or any other stretchMode, see:
http://developer.android.com/reference/android/widget/GridView.html#attr_android:stretchMode

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文