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