Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将填充项添加到子对象时Android网格布局在屏幕外_Android_Android Layout_Android Gridlayout_Fill Parent - Fatal编程技术网

将填充项添加到子对象时Android网格布局在屏幕外

将填充项添加到子对象时Android网格布局在屏幕外,android,android-layout,android-gridlayout,fill-parent,Android,Android Layout,Android Gridlayout,Fill Parent,这个名字表明我的布局有问题 我使用gridlayout来构建我的布局。我用重力和填充物(至少尝试)使它“灵敏” 问题是,在met右侧单元格上执行此操作时,单元格会伸出屏幕,而不会在屏幕边缘停止 这是我的XML代码 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:facebook="http://schemas.android.com/apk/res-auto" xmlns:tools

这个名字表明我的布局有问题

我使用gridlayout来构建我的布局。我用重力和填充物(至少尝试)使它“灵敏”

问题是,在met右侧单元格上执行此操作时,单元格会伸出屏幕,而不会在屏幕边缘停止

这是我的XML代码

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context=".InitActivit">

<!-- The primary full-screen view. This can be replaced with whatever view
     is needed to present your content, e.g. VideoView, SurfaceView,
     TextureView, etc. -->


<!-- This FrameLayout insets its children based on system windows using
     android:fitsSystemWindows. -->
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="#162229"
    android:backgroundTintMode="src_over">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent">

        <GridLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"

            android:id="@+id/gridLayout"
            android:layout_marginLeft="0dp"
            android:layout_marginBottom="0dp"
            android:layout_below="@+id/textView">


            <ImageView
                android:layout_width="match_parent"
                android:layout_height="130dp"
                android:id="@+id/imageView3"
                android:layout_row="0"
                android:layout_column="0"
                android:src="@drawable/wallpapermain"
                android:layout_gravity="top"
                android:cropToPadding="false"
                android:scaleType="fitXY"
                android:layout_columnSpan="3" />

            <com.facebook.widget.ProfilePictureView
                android:layout_width="60dp"
                android:layout_height="60dp"

                android:layout_row="1"
                android:layout_column="0"

                android:layout_gravity="top"
                android:background="@drawable/line"
                android:id="@+id/selection_profile_pic"
                android:gravity="center_horizontal"
                facebook:preset_size="small"
                android:layout_rowSpan="2" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="22dp"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="Howdy!"
                    android:id="@+id/howdyString"
                    android:layout_row="1"
                    android:layout_column="1"
                    android:textColor="#fff"
                    android:paddingTop="5dp"
                    android:layout_gravity="left"
                    android:paddingLeft="5dp"
                    android:textSize="10dp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="Small Text"
                android:id="@+id/grouplable"
                android:layout_row="1"
                android:layout_column="2" />

            <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="38dp"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="Bart"
                    android:id="@+id/nameString"
                    android:layout_row="2"
                    android:layout_column="1"
                    android:textColor="#fff"
                    android:paddingTop="5dp"
                    android:textSize="26dp"
                    android:layout_gravity="left|top"
                    android:background="@drawable/line"
                    android:paddingLeft="5dp"
                    android:paddingBottom="0dp" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="38dp"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Large Text"
                android:id="@+id/amount"
                android:layout_row="2"
                android:layout_column="2"
                android:background="@drawable/line"
                android:layout_gravity="top" />


        </GridLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Spee Bee"
            android:id="@+id/textView"
            android:gravity="center"
            android:textColor="#fff"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <ImageButton
            android:layout_width="60dp"
            android:layout_height="wrap_content"
            android:id="@+id/imageButton"
            android:layout_alignParentTop="true"
            android:layout_above="@+id/gridLayout"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/left_arrow"
            android:background="#162229" />

    </RelativeLayout>
</FrameLayout>

我还试图使所有的细胞连接在整个宽度的屏幕上。这是因为“line.xml”的底部边框

现在看起来是这样的