2016-04-16 19 views
-1

我有一個錯誤「這的LinearLayout佈局或其的FrameLayout父是無用的」在線沒有21和錯誤「在LinearLayout中無效的佈局PARAM:layout_centerHorizo​​ntal」在線29和30我在下面的代碼中有多個錯誤。下面列出的錯誤。任何方案?

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

+0

layout_centerHorizo​​ntal和layout_centerVertical這些屬性在RelativeLayout中使用,而不是在LinearLayout中使用android:gravity =「center」 –

回答

0

您的嵌套佈局不必要。只要刪除線性佈局。

你也看到這個錯誤 佈局無效PARAM在LinearLayout中:layout_centerHorizo​​ntal」 ,因爲它不是在可以的幀結構中使用的屬性

只需卸下線性佈局標籤,使旋轉器。直接子框架佈局

相關問題