简体   繁体   English

框架布局内的Android Gridview无法正确显示

[英]Android Gridview inside framelayout not showing right

i have an issue while trying to show a gridview on my FrameLayout. 尝试在FrameLayout上显示gridview时出现问题。

I'm using FrameLayout because my navigation drawer is on the same activity. 我使用FrameLayout是因为导航抽屉位于同一活动上。

The problem is the following: 问题如下:

EDIT: I had to let only the link because stackoverflow does not allow me to post images. 编辑:我只让链接,因为stackoverflow不允许我发布图像。

http://i.stack.imgur.com/yZNVI.png http://i.stack.imgur.com/yZNVI.png

And here is my code: 这是我的代码:

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">


<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff">
     <LinearLayout android:id="@+id/header"
        android:background="@layout/header_gradient"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <ImageView android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:layout_marginLeft="10.0dip"
            android:src="@drawable/logo"
            android:contentDescription="@string/img_foot_desc"/>
    </LinearLayout>
     <LinearLayout android:orientation="vertical"
        android:padding="10.0dip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <GridView
    android:id="@+id/gridView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="4dp"
    android:columnWidth="100dp"
    android:gravity="center"
    android:numColumns="auto_fit"
    android:stretchMode="columnWidth"
    android:layout_gravity="center_horizontal|center_vertical">
</GridView>
    </LinearLayout>
    <LinearLayout android:orientation="horizontal"
        android:id="@+id/footer"
        android:background="@layout/footer_repeat"
        android:layout_width="fill_parent"
        android:layout_height="90.0dip"
         />
    </FrameLayout>

<ListView
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:background="#069"/>

Any way to show it correctly? 有什么办法可以正确显示它吗?

Thanks in advance! 提前致谢!

尝试调整android:layout_margin="4dp"或将其从<GridView>..</GridView>删除。

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

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