繁体   English   中英

网格布局的最后几行被截断

[英]Grid layout last rows being cut off

我有一个布局,其中包含网格布局,如下所示

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <GridView
        android:id="@+id/gridview_gallery_mine"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginBottom="10sp"
        android:background="@color/background"
        android:gravity="center"
        android:horizontalSpacing="4dip"
        android:numColumns="4"
        android:padding="4dip"
        android:stretchMode="columnWidth"
        android:verticalSpacing="4dip" />

    <RelativeLayout
        android:id="@+id/empty_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" >

        <TextView
            android:id="@+id/textview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:text="@string/empty_list" />

    </RelativeLayout>

</RelativeLayout>

问题在于,网格的最后几行被切成两半。 我的意思是最后一行只有一半可见。 我尝试给gridview及其父级(RelativeLayout)填充,边距,但没有任何效果。 顺便说一句,我的布局在带有标签的片段内膨胀了。

PS我正在学习android设计。 谢谢。

我用过

  1. Android基本操作栏,
  2. 来自支持库的tabhost。

上一个问题的答案是,因为我没有其他实现的选择,所以在内容的父节点上应用padding bottom使其起作用。

在appcompat v7.21 (或21)中尝试了与工具栏的另一种组合, 无需额外的填充就可以工作 ,因此我花时间去调查是谁导致了问题,操作栏或tabhost。

〜希望能有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM