2013-04-12 28 views
1

我正在嘗試創建一個包含微調的UI。下面是XML(微調是幾乎到了年底):錯誤膨脹微調

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<LinearLayout style="@style/header" > 

    <Button 
     android:id="@+id/btnBack_profileEdit" 
     style="@style/header_button" 
     android:layout_gravity="center_vertical" 
     android:layout_margin="@dimen/default_button_padding" 
     android:background="@drawable/ic_button" 
     android:drawableLeft="@drawable/ic_back_arrow" 
     android:gravity="right|center_vertical" 
     android:text="@string/back" 
     android:textColor="@android:color/white" 
     android:textSize="@dimen/header_button_text" /> 

    <TextView 
     android:id="@+id/title_profileEdit" 
     style="@style/header_text" 
     android:singleLine="true" 
     android:text="@string/my_profile" /> 

    <ImageButton 
     android:id="@+id/btnSave_profileEdit" 
     style="@style/header_button" 
     android:src="@drawable/ic_add" /> 
</LinearLayout> 

<LinearLayout 
    style="@style/row" 
    android:background="@drawable/white_gradient" > 

    <TextView 
     style="@style/profile_row_content" 
     android:text="@string/first_name" 
     android:textColor="@color/black_text" /> 

    <EditText 
     android:id="@+id/firstName_profileEdit" 
     style="@style/profile_row_edit_text" 
     android:imeOptions="actionNext" /> 
</LinearLayout> 

<LinearLayout 
    style="@style/row" 
    android:background="@drawable/white_gradient" > 

    <TextView 
     style="@style/profile_row_content" 
     android:text="@string/last_name" 
     android:textColor="@color/black_text" /> 

    <EditText 
     android:id="@+id/lastName_profileEdit" 
     style="@style/profile_row_edit_text" 
     android:imeOptions="actionNext" /> 
</LinearLayout> 

<LinearLayout 
    style="@style/row" 
    android:background="@drawable/white_gradient" > 

    <TextView 
     style="@style/profile_row_content" 
     android:text="@string/email" 
     android:textColor="@color/black_text" /> 

    <EditText 
     android:id="@+id/email_profileEdit" 
     style="@style/profile_row_edit_text" 
     android:imeOptions="actionNext" /> 
</LinearLayout> 

<LinearLayout 
    style="@style/row" 
    android:background="@drawable/white_gradient" > 

    <TextView 
     style="@style/profile_row_content" 
     android:text="@string/password" 
     android:textColor="@color/black_text" /> 

    <EditText 
     android:id="@+id/password_profileEdit" 
     style="@style/profile_row_edit_text" 
     android:imeOptions="actionNext" 
     android:inputType="textPassword" /> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/lytRole_profileEdit" 
    style="@style/row" 
    android:background="@drawable/white_gradient" > 

    <TextView 
     style="@style/profile_row_content" 
     android:text="@string/role" 
     android:textColor="@color/black_text" /> 

    <Spinner 
     android:id="@+id/role_profileEdit" 
     android:layout_width="match_parent" 
     android:gravity="center_vertical" 
     android:layout_height="wrap_content" 
     android:layout_weight=".5" 
     android:entries="@string/role" /> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/lytSeparator_profileEdit" 
    style="@style/separator" > 

    <TextView 
     style="@style/separator_content" 
     android:text="@string/nickname_for_my_profile" /> 
</LinearLayout> 

<LinearLayout 
    style="@style/row" 
    android:id="@+id/lytNickname_profileEdit" 
    android:background="@drawable/white_gradient" > 

    <TextView 
     style="@style/profile_row_content" 
     android:text="@string/nickname" 
     android:textColor="@color/black_text" /> 

    <EditText 
     android:id="@+id/nickname_profileEdit" 
     style="@style/profile_row_edit_text" 
     android:layout_height="wrap_content" /> 
</LinearLayout> 

</LinearLayout> 

現在,當我試圖啓動活動,在充氣該佈局的應用程序崩潰和錯誤是:

Binary XML file line #105: Error inflating class android.widget.Spinner 

是什麼原因?

+2

你會告訴我你的活動,請你也必須做'機器人:項=「@陣列/角色」 '而不是'android:entries =「@ string/role」' –

回答

3

什麼是角色?難道又是一個<string-array>,然後

改變這一行

android:entries="@string/role" 

android:entries="@array/role" 
+0

該死!我真笨。非常感謝你! :) –

+0

是的不用擔心..我必須等待10分鐘才能接受 –

+0

我自己浪費了1個小時試圖找到問題... eclipse強調類似Visual Studio這樣的錯別字 – 2014-02-13 20:39:05

相關問題