我在下面的代码中有多个错误.下面列出了错误.任何解决方案



我在第21行出现错误"This LinearLayout layout or its FrameLayout parent is无用",在第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中的布局参数无效:layout_centerHorizontal"因为它不在可以在框架布局中使用的属性处。

只需移除线性布局标记,并使微调器成为框架布局的直接子对象。

最新更新