Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.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
Java 我在下面的代码中有多个错误。下面列出的错误。有什么解决办法吗?_Java_Android_Android Layout_Layout - Fatal编程技术网

Java 我在下面的代码中有多个错误。下面列出的错误。有什么解决办法吗?

Java 我在下面的代码中有多个错误。下面列出的错误。有什么解决办法吗?,java,android,android-layout,layout,Java,Android,Android Layout,Layout,第21行出现错误“此LinearLayout布局或其FrameLayout父级无效”,第29行和第30行出现错误“LinearLayout:layout_centerHorizontal中的布局参数无效” <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="

第21行出现错误“此LinearLayout布局或其FrameLayout父级无效”,第29行和第30行出现错误“LinearLayout:layout_centerHorizontal中的布局参数无效”

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <fragment android:id="@+id/peta"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:name="com.google.android.gms.maps.SupportMapFragment"/>
</FrameLayout>

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="96dip"
        android:orientation="vertical"
        android:weightSum="2" >
        <Spinner
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:id="@+id/spinner_list_smk">
        </Spinner>
    </LinearLayout>
</FrameLayout>


不必要的嵌套布局。只需删除线性布局

你也看到了这个错误 LinearLayout中的布局参数无效:布局\u中心水平“ 因为它不在可以在框架布局中使用的属性处


只需删除线性布局标记,并将微调器设置为框架布局的直接子级。

布局\u中心水平和布局\u中心垂直这些属性在RelativeLayout内部使用。不使用线性布局。而使用android:gravity=“center”